Browse Source

多余代码整理

noToken
安虹睿 1 year ago
parent
commit
46aee05803
  1. 116
      PC/InterFace.Dash/mock/article.js
  2. 60
      PC/InterFace.Dash/mock/index.js
  3. 84
      PC/InterFace.Dash/mock/mock-server.js
  4. 51
      PC/InterFace.Dash/mock/remote-search.js
  5. 98
      PC/InterFace.Dash/mock/role/index.js
  6. 530
      PC/InterFace.Dash/mock/role/routes.js
  7. 84
      PC/InterFace.Dash/mock/user.js
  8. 48
      PC/InterFace.Dash/mock/utils.js
  9. 5
      PC/InterFace.Dash/public/config.js
  10. 3
      PC/InterFace.Dash/src/App.vue
  11. 101
      PC/InterFace.Dash/src/api/wms-api.js
  12. 265
      PC/InterFace.Dash/src/api/wms-auth.js
  13. 20
      PC/InterFace.Dash/src/api/wms-business.js
  14. 34
      PC/InterFace.Dash/src/api/wms-interface.js
  15. 49
      PC/InterFace.Dash/src/api/wms-job.js
  16. 337
      PC/InterFace.Dash/src/components/News/dialogIndex.vue
  17. 64
      PC/InterFace.Dash/src/components/News/index.vue
  18. 1
      PC/InterFace.Dash/src/components/UploadExcel/index.vue
  19. 2
      PC/InterFace.Dash/src/components/currenDescriptions/index.vue
  20. 20
      PC/InterFace.Dash/src/components/filterForDetailPage/index.vue
  21. 2
      PC/InterFace.Dash/src/filters/index.js
  22. 2400
      PC/InterFace.Dash/src/filters/status.js
  23. 56
      PC/InterFace.Dash/src/lang/index.js
  24. 118
      PC/InterFace.Dash/src/lang/zh.js
  25. 4
      PC/InterFace.Dash/src/layout/components/Navbar.vue
  26. 2
      PC/InterFace.Dash/src/main.js
  27. 235
      PC/InterFace.Dash/src/mixins/drawerMixins.js
  28. 198
      PC/InterFace.Dash/src/mixins/mixins.js
  29. 330
      PC/InterFace.Dash/src/mixins/printMixin.js
  30. 178
      PC/InterFace.Dash/src/permission-0725.js
  31. 1
      PC/InterFace.Dash/src/permission.js
  32. 228
      PC/InterFace.Dash/src/router/index-0718.js
  33. 17
      PC/InterFace.Dash/src/router/index.js
  34. 2
      PC/InterFace.Dash/src/store/getters.js
  35. 2
      PC/InterFace.Dash/src/store/modules/definition.js
  36. 33
      PC/InterFace.Dash/src/store/modules/dictionaries.js
  37. 163
      PC/InterFace.Dash/src/store/modules/permission-0718.js
  38. 31
      PC/InterFace.Dash/src/store/modules/permission.js
  39. 92
      PC/InterFace.Dash/src/store/modules/user.js
  40. 24
      PC/InterFace.Dash/src/utils/auth.js
  41. 107
      PC/InterFace.Dash/src/utils/formatTime.js
  42. 151
      PC/InterFace.Dash/src/utils/index.js
  43. 209
      PC/InterFace.Dash/src/utils/processButtonData.js
  44. 4
      PC/InterFace.Dash/src/utils/tableColumns/index.js
  45. 3
      PC/InterFace.Dash/src/utils/tabsDesTions/index.js
  46. 246
      PC/InterFace.Dash/src/views/gridLayout/components/baseConfig/countDown.vue
  47. 222
      PC/InterFace.Dash/src/views/gridLayout/components/baseConfig/gridText.vue
  48. 366
      PC/InterFace.Dash/src/views/gridLayout/components/baseConfig/statistics.vue
  49. 186
      PC/InterFace.Dash/src/views/gridLayout/components/chart/bar.vue
  50. 194
      PC/InterFace.Dash/src/views/gridLayout/components/chart/line.vue
  51. 112
      PC/InterFace.Dash/src/views/gridLayout/components/chart/list.vue
  52. 160
      PC/InterFace.Dash/src/views/gridLayout/components/chart/pie.vue
  53. 196
      PC/InterFace.Dash/src/views/gridLayout/components/dataSource.vue
  54. 58
      PC/InterFace.Dash/src/views/gridLayout/components/grid-demo.vue
  55. 131
      PC/InterFace.Dash/src/views/gridLayout/components/gridLayout.js
  56. 59
      PC/InterFace.Dash/src/views/gridLayout/components/gridLayout.scss
  57. 500
      PC/InterFace.Dash/src/views/gridLayout/index.vue
  58. 100
      PC/InterFace.Dash/src/views/gridLayout/indexShow.vue
  59. 140
      PC/InterFace.Dash/src/views/profileuser/index.vue
  60. 99
      PC/InterFace.Dash/src/views/profileuser/resetPwd.vue
  61. 80
      PC/InterFace.Dash/src/views/profileuser/userInfo.vue
  62. 262
      PC/InterFace.Dash/src/views/systemManage/pcMenu.vue
  63. 655
      PC/InterFace.Dash/src/views/systemManage/pcUserManage.vue
  64. 705
      PC/InterFace.Dash/src/views/systemManage/roleManage.vue
  65. 818
      PC/InterFace.Dash/src/views/systemManage/userManage.vue
  66. 661
      PC/InterFace.Dash/src/views/systemManage/userWorkGroup.vue

116
PC/InterFace.Dash/mock/article.js

@ -1,116 +0,0 @@
const Mock = require('mockjs')
const List = []
const count = 100
const baseContent = '<p>I am testing data, I am testing data.</p><p><img src="https://wpimg.wallstcn.com/4c69009c-0fd4-4153-b112-6cb53d1cf943"></p>'
const image_uri = 'https://wpimg.wallstcn.com/e4558086-631c-425c-9430-56ffb46e70b3'
for (let i = 0; i < count; i++) {
List.push(Mock.mock({
id: '@increment',
timestamp: +Mock.Random.date('T'),
author: '@first',
reviewer: '@first',
title: '@title(5, 10)',
content_short: 'mock data',
content: baseContent,
forecast: '@float(0, 100, 2, 2)',
importance: '@integer(1, 3)',
'type|1': ['CN', 'US', 'JP', 'EU'],
'status|1': ['published', 'draft'],
display_time: '@datetime',
comment_disabled: true,
pageviews: '@integer(300, 5000)',
image_uri,
platforms: ['a-platform']
}))
}
module.exports = [
{
url: '/vue-element-admin/article/list',
type: 'get',
response: config => {
const { importance, type, title, page = 1, limit = 20, sort } = config.query
let mockList = List.filter(item => {
if (importance && item.importance !== +importance) return false
if (type && item.type !== type) return false
if (title && item.title.indexOf(title) < 0) return false
return true
})
if (sort === '-id') {
mockList = mockList.reverse()
}
const pageList = mockList.filter((item, index) => index < limit * page && index >= limit * (page - 1))
return {
code: 20000,
data: {
total: mockList.length,
items: pageList
}
}
}
},
{
url: '/vue-element-admin/article/detail',
type: 'get',
response: config => {
const { id } = config.query
for (const article of List) {
if (article.id === +id) {
return {
code: 20000,
data: article
}
}
}
}
},
{
url: '/vue-element-admin/article/pv',
type: 'get',
response: _ => {
return {
code: 20000,
data: {
pvData: [
{ key: 'PC', pv: 1024 },
{ key: 'mobile', pv: 1024 },
{ key: 'ios', pv: 1024 },
{ key: 'android', pv: 1024 }
]
}
}
}
},
{
url: '/vue-element-admin/article/create',
type: 'post',
response: _ => {
return {
code: 20000,
data: 'success'
}
}
},
{
url: '/vue-element-admin/article/update',
type: 'post',
response: _ => {
return {
code: 20000,
data: 'success'
}
}
}
]

60
PC/InterFace.Dash/mock/index.js

@ -1,60 +0,0 @@
const Mock = require('mockjs')
const { param2Obj } = require('./utils')
const user = require('./user')
const role = require('./role')
const article = require('./article')
const search = require('./remote-search')
const mocks = [
...user,
...role,
...article,
...search
]
// for front mock
// please use it cautiously, it will redefine XMLHttpRequest,
// which will cause many of your third-party libraries to be invalidated(like progress event).
function mockXHR() {
// mock patch
// https://github.com/nuysoft/Mock/issues/300
Mock.XHR.prototype.proxy_send = Mock.XHR.prototype.send
Mock.XHR.prototype.send = function() {
if (this.custom.xhr) {
this.custom.xhr.withCredentials = this.withCredentials || false
if (this.responseType) {
this.custom.xhr.responseType = this.responseType
}
}
this.proxy_send(...arguments)
}
function XHR2ExpressReqWrap(respond) {
return function(options) {
let result = null
if (respond instanceof Function) {
const { body, type, url } = options
// https://expressjs.com/en/4x/api.html#req
result = respond({
method: type,
body: JSON.parse(body),
query: param2Obj(url)
})
} else {
result = respond
}
return Mock.mock(result)
}
}
for (const i of mocks) {
Mock.mock(new RegExp(i.url), i.type || 'get', XHR2ExpressReqWrap(i.response))
}
}
module.exports = {
mocks,
mockXHR
}

84
PC/InterFace.Dash/mock/mock-server.js

@ -1,84 +0,0 @@
const chokidar = require('chokidar')
const bodyParser = require('body-parser')
const chalk = require('chalk')
const path = require('path')
const Mock = require('mockjs')
const mockDir = path.join(process.cwd(), 'mock')
function registerRoutes(app) {
let mockLastIndex
const { mocks } = require('./index.js')
const mocksForServer = mocks.map(route => {
return responseFake(route.url, route.type, route.response)
})
for (const mock of mocksForServer) {
// app[mock.type](mock.url, mock.response)
app[mock.type](mock.url, bodyParser.json(),bodyParser.urlencoded({ //添加
extended:true
}),mock.response)
mockLastIndex = app._router.stack.length
}
const mockRoutesLength = Object.keys(mocksForServer).length
return {
mockRoutesLength: mockRoutesLength,
mockStartIndex: mockLastIndex - mockRoutesLength
}
}
function unregisterRoutes() {
Object.keys(require.cache).forEach(i => {
if (i.includes(mockDir)) {
delete require.cache[require.resolve(i)]
}
})
}
// for mock server
const responseFake = (url, type, respond) => {
return {
url: new RegExp(`${process.env.VUE_APP_BASE_API}${url}`),
type: type || 'get',
response(req, res) {
console.log('request invoke:' + req.path)
res.json(Mock.mock(respond instanceof Function ? respond(req, res) : respond))
}
}
}
module.exports = app => {
// parse app.body
// https://expressjs.com/en/4x/api.html#req.body
// app.use(bodyParser.json())
// app.use(bodyParser.urlencoded({
// extended: true
// }))
const mockRoutes = registerRoutes(app)
var mockRoutesLength = mockRoutes.mockRoutesLength
var mockStartIndex = mockRoutes.mockStartIndex
// watch files, hot reload mock server
chokidar.watch(mockDir, {
ignored: /mock-server/,
ignoreInitial: true
}).on('all', (event, path) => {
if (event === 'change' || event === 'add') {
try {
// remove mock routes stack
app._router.stack.splice(mockStartIndex, mockRoutesLength)
// clear routes cache
unregisterRoutes()
const mockRoutes = registerRoutes(app)
mockRoutesLength = mockRoutes.mockRoutesLength
mockStartIndex = mockRoutes.mockStartIndex
console.log(chalk.magentaBright(`\n > Mock Server hot reload success! changed ${path}`))
} catch (error) {
console.log(chalk.redBright(error))
}
}
})
}

51
PC/InterFace.Dash/mock/remote-search.js

@ -1,51 +0,0 @@
const Mock = require('mockjs')
const NameList = []
const count = 100
for (let i = 0; i < count; i++) {
NameList.push(Mock.mock({
name: '@first'
}))
}
NameList.push({ name: 'mock-Pan' })
module.exports = [
// username search
{
url: '/vue-element-admin/search/user',
type: 'get',
response: config => {
const { name } = config.query
const mockNameList = NameList.filter(item => {
const lowerCaseName = item.name.toLowerCase()
return !(name && lowerCaseName.indexOf(name.toLowerCase()) < 0)
})
return {
code: 20000,
data: { items: mockNameList }
}
}
},
// transaction list
{
url: '/vue-element-admin/transaction/list',
type: 'get',
response: _ => {
return {
code: 20000,
data: {
total: 20,
'items|20': [{
order_no: '@guid()',
timestamp: +Mock.Random.date('T'),
username: '@name()',
price: '@float(1000, 15000, 0, 2)',
'status|1': ['success', 'pending']
}]
}
}
}
}
]

98
PC/InterFace.Dash/mock/role/index.js

@ -1,98 +0,0 @@
const Mock = require('mockjs')
const { deepClone } = require('../utils')
const { asyncRoutes, constantRoutes } = require('./routes.js')
const routes = deepClone([...constantRoutes, ...asyncRoutes])
const roles = [
{
key: 'admin',
name: 'admin',
description: 'Super Administrator. Have access to view all pages.',
routes: routes
},
{
key: 'editor',
name: 'editor',
description: 'Normal Editor. Can see all pages except permission page',
routes: routes.filter(i => i.path !== '/permission')// just a mock
},
{
key: 'visitor',
name: 'visitor',
description: 'Just a visitor. Can only see the home page and the document page',
routes: [{
path: '',
redirect: 'dashboard',
children: [
{
path: 'dashboard',
name: 'Dashboard',
meta: { title: 'dashboard', icon: 'dashboard' }
}
]
}]
}
]
module.exports = [
// mock get all routes form server
{
url: '/vue-element-admin/routes',
type: 'get',
response: _ => {
return {
code: 20000,
data: routes
}
}
},
// mock get all roles form server
{
url: '/vue-element-admin/roles',
type: 'get',
response: _ => {
return {
code: 20000,
data: roles
}
}
},
// add role
{
url: '/vue-element-admin/role',
type: 'post',
response: {
code: 20000,
data: {
key: Mock.mock('@integer(300, 5000)')
}
}
},
// update role
{
url: '/vue-element-admin/role/[A-Za-z0-9]',
type: 'put',
response: {
code: 20000,
data: {
status: 'success'
}
}
},
// delete role
{
url: '/vue-element-admin/role/[A-Za-z0-9]',
type: 'delete',
response: {
code: 20000,
data: {
status: 'success'
}
}
}
]

530
PC/InterFace.Dash/mock/role/routes.js

@ -1,530 +0,0 @@
// Just a mock data
const constantRoutes = [
{
path: '/redirect',
component: 'layout/Layout',
hidden: true,
children: [
{
path: '/redirect/:path*',
component: 'views/redirect/index'
}
]
},
{
path: '/login',
component: 'views/login/index',
hidden: true
},
{
path: '/auth-redirect',
component: 'views/login/auth-redirect',
hidden: true
},
{
path: '/404',
component: 'views/error-page/404',
hidden: true
},
{
path: '/401',
component: 'views/error-page/401',
hidden: true
},
{
path: '',
component: 'layout/Layout',
redirect: 'dashboard',
children: [
{
path: 'dashboard',
component: 'views/dashboard/index',
name: 'Dashboard',
meta: { title: 'Dashboard', icon: 'dashboard', affix: true }
}
]
},
{
path: '/documentation',
component: 'layout/Layout',
children: [
{
path: 'index',
component: 'views/documentation/index',
name: 'Documentation',
meta: { title: 'Documentation', icon: 'documentation', affix: true }
}
]
},
{
path: '/guide',
component: 'layout/Layout',
redirect: '/guide/index',
children: [
{
path: 'index',
component: 'views/guide/index',
name: 'Guide',
meta: { title: 'Guide', icon: 'guide', noCache: true }
}
]
}
]
const asyncRoutes = [
{
path: '/permission',
component: 'layout/Layout',
redirect: '/permission/index',
alwaysShow: true,
meta: {
title: 'Permission',
icon: 'lock',
roles: ['admin', 'editor']
},
children: [
{
path: 'page',
component: 'views/permission/page',
name: 'PagePermission',
meta: {
title: 'Page Permission',
roles: ['admin']
}
},
{
path: 'directive',
component: 'views/permission/directive',
name: 'DirectivePermission',
meta: {
title: 'Directive Permission'
}
},
{
path: 'role',
component: 'views/permission/role',
name: 'RolePermission',
meta: {
title: 'Role Permission',
roles: ['admin']
}
}
]
},
{
path: '/icon',
component: 'layout/Layout',
children: [
{
path: 'index',
component: 'views/icons/index',
name: 'Icons',
meta: { title: 'Icons', icon: 'icon', noCache: true }
}
]
},
{
path: '/components',
component: 'layout/Layout',
redirect: 'noRedirect',
name: 'ComponentDemo',
meta: {
title: 'Components',
icon: 'component'
},
children: [
{
path: 'tinymce',
component: 'views/components-demo/tinymce',
name: 'TinymceDemo',
meta: { title: 'Tinymce' }
},
{
path: 'markdown',
component: 'views/components-demo/markdown',
name: 'MarkdownDemo',
meta: { title: 'Markdown' }
},
{
path: 'json-editor',
component: 'views/components-demo/json-editor',
name: 'JsonEditorDemo',
meta: { title: 'Json Editor' }
},
{
path: 'split-pane',
component: 'views/components-demo/split-pane',
name: 'SplitpaneDemo',
meta: { title: 'SplitPane' }
},
{
path: 'avatar-upload',
component: 'views/components-demo/avatar-upload',
name: 'AvatarUploadDemo',
meta: { title: 'Avatar Upload' }
},
{
path: 'dropzone',
component: 'views/components-demo/dropzone',
name: 'DropzoneDemo',
meta: { title: 'Dropzone' }
},
{
path: 'sticky',
component: 'views/components-demo/sticky',
name: 'StickyDemo',
meta: { title: 'Sticky' }
},
{
path: 'count-to',
component: 'views/components-demo/count-to',
name: 'CountToDemo',
meta: { title: 'Count To' }
},
{
path: 'mixin',
component: 'views/components-demo/mixin',
name: 'ComponentMixinDemo',
meta: { title: 'componentMixin' }
},
{
path: 'back-to-top',
component: 'views/components-demo/back-to-top',
name: 'BackToTopDemo',
meta: { title: 'Back To Top' }
},
{
path: 'drag-dialog',
component: 'views/components-demo/drag-dialog',
name: 'DragDialogDemo',
meta: { title: 'Drag Dialog' }
},
{
path: 'drag-select',
component: 'views/components-demo/drag-select',
name: 'DragSelectDemo',
meta: { title: 'Drag Select' }
},
{
path: 'dnd-list',
component: 'views/components-demo/dnd-list',
name: 'DndListDemo',
meta: { title: 'Dnd List' }
},
{
path: 'drag-kanban',
component: 'views/components-demo/drag-kanban',
name: 'DragKanbanDemo',
meta: { title: 'Drag Kanban' }
}
]
},
{
path: '/charts',
component: 'layout/Layout',
redirect: 'noRedirect',
name: 'Charts',
meta: {
title: 'Charts',
icon: 'chart'
},
children: [
{
path: 'keyboard',
component: 'views/charts/keyboard',
name: 'KeyboardChart',
meta: { title: 'Keyboard Chart', noCache: true }
},
{
path: 'line',
component: 'views/charts/line',
name: 'LineChart',
meta: { title: 'Line Chart', noCache: true }
},
{
path: 'mixchart',
component: 'views/charts/mixChart',
name: 'MixChart',
meta: { title: 'Mix Chart', noCache: true }
}
]
},
{
path: '/nested',
component: 'layout/Layout',
redirect: '/nested/menu1/menu1-1',
name: 'Nested',
meta: {
title: 'Nested',
icon: 'nested'
},
children: [
{
path: 'menu1',
component: 'views/nested/menu1/index',
name: 'Menu1',
meta: { title: 'Menu1' },
redirect: '/nested/menu1/menu1-1',
children: [
{
path: 'menu1-1',
component: 'views/nested/menu1/menu1-1',
name: 'Menu1-1',
meta: { title: 'Menu1-1' }
},
{
path: 'menu1-2',
component: 'views/nested/menu1/menu1-2',
name: 'Menu1-2',
redirect: '/nested/menu1/menu1-2/menu1-2-1',
meta: { title: 'Menu1-2' },
children: [
{
path: 'menu1-2-1',
component: 'views/nested/menu1/menu1-2/menu1-2-1',
name: 'Menu1-2-1',
meta: { title: 'Menu1-2-1' }
},
{
path: 'menu1-2-2',
component: 'views/nested/menu1/menu1-2/menu1-2-2',
name: 'Menu1-2-2',
meta: { title: 'Menu1-2-2' }
}
]
},
{
path: 'menu1-3',
component: 'views/nested/menu1/menu1-3',
name: 'Menu1-3',
meta: { title: 'Menu1-3' }
}
]
},
{
path: 'menu2',
name: 'Menu2',
component: 'views/nested/menu2/index',
meta: { title: 'Menu2' }
}
]
},
{
path: '/example',
component: 'layout/Layout',
redirect: '/example/list',
name: 'Example',
meta: {
title: 'Example',
icon: 'example'
},
children: [
{
path: 'create',
component: 'views/example/create',
name: 'CreateArticle',
meta: { title: 'Create Article', icon: 'edit' }
},
{
path: 'edit/:id(\\d+)',
component: 'views/example/edit',
name: 'EditArticle',
meta: { title: 'Edit Article', noCache: true },
hidden: true
},
{
path: 'list',
component: 'views/example/list',
name: 'ArticleList',
meta: { title: 'Article List', icon: 'list' }
}
]
},
{
path: '/tab',
component: 'layout/Layout',
children: [
{
path: 'index',
component: 'views/tab/index',
name: 'Tab',
meta: { title: 'Tab', icon: 'tab' }
}
]
},
{
path: '/error',
component: 'layout/Layout',
redirect: 'noRedirect',
name: 'ErrorPages',
meta: {
title: 'Error Pages',
icon: '404'
},
children: [
{
path: '401',
component: 'views/error-page/401',
name: 'Page401',
meta: { title: 'Page 401', noCache: true }
},
{
path: '404',
component: 'views/error-page/404',
name: 'Page404',
meta: { title: 'Page 404', noCache: true }
}
]
},
{
path: '/error-log',
component: 'layout/Layout',
redirect: 'noRedirect',
children: [
{
path: 'log',
component: 'views/error-log/index',
name: 'ErrorLog',
meta: { title: 'Error Log', icon: 'bug' }
}
]
},
{
path: '/excel',
component: 'layout/Layout',
redirect: '/excel/export-excel',
name: 'Excel',
meta: {
title: 'Excel',
icon: 'excel'
},
children: [
{
path: 'export-excel',
component: 'views/excel/export-excel',
name: 'ExportExcel',
meta: { title: 'Export Excel' }
},
{
path: 'export-selected-excel',
component: 'views/excel/select-excel',
name: 'SelectExcel',
meta: { title: 'Select Excel' }
},
{
path: 'export-merge-header',
component: 'views/excel/merge-header',
name: 'MergeHeader',
meta: { title: 'Merge Header' }
},
{
path: 'upload-excel',
component: 'views/excel/upload-excel',
name: 'UploadExcel',
meta: { title: 'Upload Excel' }
}
]
},
{
path: '/zip',
component: 'layout/Layout',
redirect: '/zip/download',
alwaysShow: true,
meta: { title: 'Zip', icon: 'zip' },
children: [
{
path: 'download',
component: 'views/zip/index',
name: 'ExportZip',
meta: { title: 'Export Zip' }
}
]
},
{
path: '/pdf',
component: 'layout/Layout',
redirect: '/pdf/index',
children: [
{
path: 'index',
component: 'views/pdf/index',
name: 'PDF',
meta: { title: 'PDF', icon: 'pdf' }
}
]
},
{
path: '/pdf/download',
component: 'views/pdf/download',
hidden: true
},
{
path: '/theme',
component: 'layout/Layout',
redirect: 'noRedirect',
children: [
{
path: 'index',
component: 'views/theme/index',
name: 'Theme',
meta: { title: 'Theme', icon: 'theme' }
}
]
},
{
path: '/clipboard',
component: 'layout/Layout',
redirect: 'noRedirect',
children: [
{
path: 'index',
component: 'views/clipboard/index',
name: 'ClipboardDemo',
meta: { title: 'Clipboard Demo', icon: 'clipboard' }
}
]
},
{
path: '/i18n',
component: 'layout/Layout',
children: [
{
path: 'index',
component: 'views/i18n-demo/index',
name: 'I18n',
meta: { title: 'I18n', icon: 'international' }
}
]
},
{
path: 'external-link',
component: 'layout/Layout',
children: [
{
path: 'https://github.com/PanJiaChen/vue-element-admin',
meta: { title: 'External Link', icon: 'link' }
}
]
},
{ path: '*', redirect: '/404', hidden: true }
]
module.exports = {
constantRoutes,
asyncRoutes
}

84
PC/InterFace.Dash/mock/user.js

@ -1,84 +0,0 @@
const tokens = {
admin: {
token: 'admin-token'
},
editor: {
token: 'editor-token'
}
}
const users = {
'admin-token': {
roles: ['admin'],
introduction: 'I am a super administrator',
avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
name: 'Super Admin'
},
'editor-token': {
roles: ['editor'],
introduction: 'I am an editor',
avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
name: 'Normal Editor'
}
}
module.exports = [
// user login
{
url: '/vue-element-admin/user/login',
type: 'post',
response: config => {
const { username } = config.body
const token = tokens[username]
// mock error
if (!token) {
return {
code: 60204,
message: 'Account and password are incorrect.'
}
}
return {
code: 20000,
data: token
}
}
},
// get user info
{
url: '/vue-element-admin/user/info\.*',
type: 'get',
response: config => {
const { token } = config.query
const info = users[token]
// mock error
if (!info) {
return {
code: 50008,
message: 'Login failed, unable to get user details.'
}
}
return {
code: 20000,
data: info
}
}
},
// user logout
{
url: '/vue-element-admin/user/logout',
type: 'post',
response: _ => {
return {
code: 20000,
data: 'success'
}
}
}
]

48
PC/InterFace.Dash/mock/utils.js

@ -1,48 +0,0 @@
/**
* @param {string} url
* @returns {Object}
*/
function param2Obj(url) {
const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ')
if (!search) {
return {}
}
const obj = {}
const searchArr = search.split('&')
searchArr.forEach(v => {
const index = v.indexOf('=')
if (index !== -1) {
const name = v.substring(0, index)
const val = v.substring(index + 1, v.length)
obj[name] = val
}
})
return obj
}
/**
* This is just a simple version of deep copy
* Has a lot of edge cases bug
* If you want to use a perfect deep copy, use lodash's _.cloneDeep
* @param {Object} source
* @returns {Object}
*/
function deepClone(source) {
if (!source && typeof source !== 'object') {
throw new Error('error arguments', 'deepClone')
}
const targetObj = source.constructor === Array ? [] : {}
Object.keys(source).forEach(keys => {
if (source[keys] && typeof source[keys] === 'object') {
targetObj[keys] = deepClone(source[keys])
} else {
targetObj[keys] = source[keys]
}
})
return targetObj
}
module.exports = {
param2Obj,
deepClone
}

5
PC/InterFace.Dash/public/config.js

@ -1,6 +1,7 @@
// dev_win
window.SITE_CONFIG['base'] = 'http://dev.ccwin-in.com:60068'
// window.SITE_CONFIG['base'] = 'http://192.168.0.180:60068'
window.SITE_CONFIG['baseApi'] = 'http://dev.ccwin-in.com:60068'
// window.SITE_CONFIG['baseApi'] = 'http://192.168.0.190:60068'
window.SITE_CONFIG['authApi'] = 'http://dev.ccwin-in.com:60068'
window.SITE_CONFIG['businessApi'] = 'http://dev.ccwin-in.com:10097'
window.SITE_CONFIG['columnsApiNamesZh'] = 'Z'
window.SITE_CONFIG['isAutoLogin'] = true

3
PC/InterFace.Dash/src/App.vue

@ -8,7 +8,8 @@
export default {
name: 'App'
}
localStorage.setItem('base',window.SITE_CONFIG['base'])
localStorage.setItem('baseApi',window.SITE_CONFIG['baseApi'])
localStorage.setItem('authApi',window.SITE_CONFIG['authApi'])
localStorage.setItem('businessApi',window.SITE_CONFIG['businessApi'])
localStorage.setItem('columnsApiNamesZh',window.SITE_CONFIG['columnsApiNamesZh'])
localStorage.setItem('isAutoLogin',window.SITE_CONFIG['isAutoLogin'])

101
PC/InterFace.Dash/src/api/wms-api.js

@ -1,8 +1,8 @@
import request from '@/utils/request'
import store from '@/store'
// let baseURL = process.env.VUE_APP_BASE_API + '/'
let baseURL = localStorage.getItem('base') + '/api/'
let printURL = localStorage.getItem('print') + '/api/'
let baseURL = localStorage.getItem('baseApi') + '/api/'
//新建
export function postCreate(data, url) {
if (Object.keys(data).includes('company')) {
@ -30,22 +30,6 @@ export function postUpdate(data, id, url) {
params:{id:id}
})
}
//申请流程
export function processRequest(id, url) {
return request({
url: baseURL + url + id,
method: 'post',
})
}
//子表编辑
export function postDetailUpdate(data, id, UrlData, url) {
return request({
url: baseURL + url + '/detail/' + id,
method: 'put',
params: UrlData,
data
})
}
//删除
export function postDelete(id, url) {
return request({
@ -55,14 +39,6 @@ export function postDelete(id, url) {
params:{id:id}
})
}
//子表删除
// export function postDetailDelete(id, UrlData, url) {
// return request({
// url: baseURL + url + '/detail/' + id,
// method: 'delete',
// params: UrlData
// })
// }
//分页+筛选【列表】
export function getPageList(data, url, includeDetails) {
let _url = includeDetails ? baseURL + url + '/get-list-page-by-filter?includeDetails='+ includeDetails : baseURL + url + '/get-list-page-by-filter'
@ -72,7 +48,6 @@ export function getPageList(data, url, includeDetails) {
data
})
}
//分页+筛选【明细列表】
export function getPageListForDetail(data, url, includeDetails) {
return request({
@ -81,8 +56,6 @@ export function getPageListForDetail(data, url, includeDetails) {
data
})
}
// 根据id获取主表信息
export function getListDesById(url,id) {
return request({
@ -90,7 +63,6 @@ export function getListDesById(url,id) {
url: baseURL + url + '/' + id
})
}
//导出-获取文件 blobName
/**
* @param {*} data
@ -132,14 +104,6 @@ export function fileStorage(data) {
params: data,
})
}
//导入-新-创建文件
export function fileStorageCreate(data) {
return request({
url: baseURL + 'filestore/file/create',
method: 'post',
data
})
}
//导入 isSpecial 是否为特殊接口
export function postImport(data, url,isSpecial) {
let _url = isSpecial ? url : url + '/import'
@ -161,9 +125,6 @@ export function postImportDown(url) {
responseType: 'blob'
})
}
//---------------------------通用---------------------------
//获取详情
export function getDetailed(id, url) {
return request({
@ -171,8 +132,7 @@ export function getDetailed(id, url) {
method: 'get',
})
}
//---------------------------只查询-------------------------
//获取分页+筛选
//获取分页+筛选(只查询)
export function getPage(data, url) {
return request({
url: baseURL + url,
@ -180,61 +140,6 @@ export function getPage(data, url) {
params: data
})
}
//打印标签
export function PrintServices(data) {
return request({
url: printURL + 'reporting/PrintServices',
method: 'post',
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
},
transformRequest: [
function (data) {
var ret = ''
for (var it in data) {
ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
}
ret = ret.substring(0, ret.lastIndexOf('&'))
return ret
}
],
data
})
}
//首页——获取当前用户未读消息
export function userNotifyNotReadList(userId) {
return request({
url: baseURL + 'message/user-notify-message/not-read-list/' + userId,
method: 'get'
})
}
//首页——获取当前用户已读消息
export function userNotifyHasRead(userId) {
return request({
url: baseURL + 'message/user-notify-message/has-read-list/' + userId,
method: 'get'
})
}
//首页——修改当前用户消息状态
export function userNotifyMessageUpdate(id) {
return request({
url: baseURL + 'message/user-notify-message/read/' + id,
method: 'post'
})
}
//首页——获取当前用户消息详情
export function notifyMessage(params, id) {
return request({
url: baseURL + 'message/notify-message/' + id,
method: 'get',
params: params,
})
}
// 获取版本编号
export function getVsersion() {
return request({

265
PC/InterFace.Dash/src/api/wms-auth.js

@ -1,9 +1,9 @@
import request from '@/utils/request'
let baseURL = localStorage.getItem('base') + '/api'
let authApi = localStorage.getItem('authApi') + '/api'
export function login(data) {
return request({
url: baseURL + '/account/login',
url: authApi + '/account/login',
method: 'post',
data
})
@ -11,268 +11,57 @@ export function login(data) {
export function token(data) {
return request({
// url: baseURL + '/token',
url: baseURL + '/connect/token',
url: authApi + '/connect/token',
method: 'post',
data
})
}
export function getInfo() {
return request({
url: baseURL + '/abp/application-configuration',
method: 'get',
})
}
export function logout() {
return request({
url: baseURL + '/account/logout',
url: authApi + '/account/logout',
method: 'get'
})
}
//新建
export function postCreate(data) {
return request({
url: baseURL + '/identity/users',
method: 'post',
data
})
}
//获取全部角色 | 用户信息维护
export function usersroles() {
return request({
url: baseURL + '/identity/users/assignable-roles',
method: 'get'
})
}
//获取当前角色 | 用户信息维护
export function getusersID(data) {
return request({
url: baseURL + '/identity/users/' + data + '/roles',
method: 'get'
})
}
//编辑
export function postUpdate(data, id) {
return request({
url: baseURL + '/identity/users/' + id,
method: 'put',
data
})
}
//删除
export function postDelete(id) {
return request({
url: baseURL + '/identity/users/' + id,
method: 'delete',
})
}
//分页+筛选
export function getPageList(data) {
return request({
url: baseURL + '/identity/users',
method: 'get',
params: data
})
}
//重置密码功能 | 用户信息维护
export function putpassword(id) {
return request({
url: baseURL + '/identity/users/reset-password/' + id,
method: 'post'
})
}
//获取全部权限(包含PDA+pc) | PC菜单信息维护 | PDA菜单信息维护 | PDA用户权限维护 | PC角色权限维护
export function menuPermissions(data) {
return request({
url: baseURL + '/auth/menu/list',
method: 'post',
data
})
}
//新建菜单 | PC菜单信息维护 | PDA菜单信息维护
export function postCreateMenu(data) {
return request({
url: baseURL + '/auth/menu',
method: 'post',
data
})
}
//编辑菜单 | PC菜单信息维护 | PDA菜单信息维护
export function postUpdateMenu(data, id) {
return request({
url: baseURL + '/auth/menu/' + id,
method: 'put',
data
})
}
//删除菜单 | PC菜单信息维护 | PDA菜单信息维护
export function postDeleteMenu(id) {
return request({
url: baseURL + '/auth/menu/' + id,
method: 'delete',
})
}
//获取菜单详情 | PC菜单信息维护 | PDA菜单信息维护
export function getDetailedMenu(id) {
return request({
url: baseURL + '/auth/menu/' + id,
method: 'get',
})
}
//获取用户全部工作组 | 用户工作组对应关系
// export function workgroupPermissions() {
// return request({
// url: baseURL + '/auth/user-workgroup/get-list',
// method: 'get',
// params:{
// SkipCount:0,
// MaxResultCount:100
// }
// })
// }
//获取已有权限 | PDA用户权限维护
export function UserPermissions(id, url) {
return request({
url: baseURL + '/' + url + '/' + id.userId,
method: 'get',
params:id
})
}
//保存权限 | PDA用户权限维护
export function SetUserPermissions(data, id, url) {
return request({
url: baseURL + '/' + url + '/' + id.userId,
method: 'put',
params:id,
data
})
}
//获取用户已有工作组 | 用户工作组对应关系
export function userWorkgroupPermissions(id) {
// faster-new
// 通过用户名获取用户信息
export function getUsersByUserName(name) {
return request({
url: baseURL + '/auth/user-workgroup/get-user-work-group-by-user-id',
url: authApi + '/identity/users/by-username/'+name,
method: 'get',
params:id
})
}
//保存用户与工作组关系 | 用户工作组对应关系
export function SetUserWorkgroupPermissions(data,id) {
return request({
url: baseURL + '/auth/user-workgroup/add-many',
method: 'post',
params:id,
data
})
}
//加载用户登录信息
export function loadLoginUserInfo(id) {
return request({
url: baseURL + '/identity/users/' + id,
method: 'get'
})
}
//修改登录用户基本信息
export function putLoginUserInfo(data) {
return request({
url: baseURL + '/identity/my-profile',
method: 'put',
data
})
}
//修改登录用户的密码-强密码规则
export function postLoginUserInfo(data, id) {
return request({
url: baseURL + '/identity/users/change-password/' + id,
method: 'post',
data
})
}
//获取部门列表 | 用户信息维护 | 部门信息维护
export function departmentList(data) {
return request({
url: baseURL + '/auth/department/list',
method: 'post',
data
})
}
//获取明细列
export function getDetailed(id, url) {
// 获取表头zh转义数据
export function getInterfaceBoard() {
return request({
url: baseURL + url + id,
method: 'get'
method:'get',
url: authApi + '/abp/application-localization',
params:{
CultureName:localStorage.getItem('browserLanguage'),
OnlyDynamics:false
}
// params:{IncludeLocalizationResources:true}
})
}
//-------------------------------------
// 创建 | PC角色权限维护
export function postCreateRoles(data) {
return request({
url: baseURL + '/identity/roles',
method: 'post',
data
})
}
//编辑 | PC角色权限维护
export function postUpdateRoles(data, id) {
// 获取菜单数据
export function getDefinitionMenu(IncludeTypes) {
return request({
url: baseURL+'/identity/roles/' + id,
method: 'put',
data
})
}
//删除 | PC角色权限维护
export function postDeleteRoles(id) {
return request({
url: baseURL + '/identity/roles/' + id,
method: 'delete',
})
}
// 描述修改 | PC角色权限维护
export function saveOrUpdateDescribe(params,id) {
return request({
url: baseURL + '/identity/roles/' + id + '/description',
method: 'post',
params: params
})
}
//分页+筛选 | PC角色权限维护
export function getPageListRoles(data) {
return request({
url: baseURL + '/identity/roles',
method: 'get',
params: data
method:'get',
url: authApi + '/abp/application-configuration',
params:{IncludeLocalizationResources:true}
})
}
//获取权限模板 | PC角色权限维护
export function getpermissionsRoles(data) {
return request({
url: baseURL +'/permission-management/permissions',
method: 'get',
params: data
})
}
//保存权限模板 | PC角色权限维护
export function putpermissionsRoles(url, data) {
// 获取枚举数据/dto列类型等所有配置
export async function getApiDefinition() {
return request({
url: baseURL+ url,
method: 'put',
data
method:'get',
url: authApi + '/abp/api-definition',
params:{IncludeTypes:true}
})
}
// faster-new
export function getUsersByUserName(name) {
return request({
url: baseURL + '/identity/users/by-username/'+name,
method: 'get',
})
}

20
PC/InterFace.Dash/src/api/wms-business.js

@ -18,22 +18,4 @@ export function resetHandle(params,data,url) {
params:params,
data
})
}
// // 测试数据-明细-列表
// export function TestSchoolDetailList(data,includeDetails) {
// return request({
// method:'post',
// url: base_api + '/api/TestStudentDetail/base/get-list-page-by-filter?includeDetails='+Boolean(includeDetails),
// data
// })
// }
// // 测试数据-明细-删除
// export function TestSchoolDetailList_delete(id) {
// return request({
// method:'DELETE',
// url: base_api + '/api/TestStudentDetail/base/delete-by-id',
// params:{id:id}
// })
// }
}

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

@ -1,34 +0,0 @@
// 接口监控看板相关api
import request from '@/utils/request'
let base_api = localStorage.getItem('base')
// 获取表头zh转义数据
export function getInterfaceBoard() {
return request({
method:'get',
url: base_api + '/api/abp/application-localization',
params:{
CultureName:localStorage.getItem('browserLanguage'),
OnlyDynamics:false
}
// params:{IncludeLocalizationResources:true}
})
}
// 获取菜单数据
export function getDefinitionMenu(IncludeTypes) {
return request({
method:'get',
url: base_api + '/api/abp/application-configuration',
params:{IncludeLocalizationResources:true}
})
}
// 获取枚举数据/dto列类型等所有配置
export async function getApiDefinition() {
return request({
method:'get',
url: base_api + '/api/abp/api-definition',
params:{IncludeTypes:true}
})
}

49
PC/InterFace.Dash/src/api/wms-job.js

@ -1,49 +0,0 @@
import request from '@/utils/request'
// let baseURL = process.env.VUE_APP_BASE_API + '/'
let baseURL = localStorage.getItem('base') + '/api/'
//---------------------------通用---------------------------
//任务流程——承接
export function accept(url, data) {
return request({
url: baseURL + url + '/accept/'+data.id,
method: 'post',
// params: data
})
}
//任务流程——关闭
export function close(url, data) {
return request({
url: baseURL + url + '/close/'+data.id,
method: 'post',
// params: data
})
}
//任务流程——取消
export function cancel(url, data) {
return request({
url: baseURL + url + '/cancel/'+data.id,
method: 'post',
// params: data
})
}
//任务流程——取消承接 | 采购收货任务
export function cancelAccept(url, data) {
return request({
url: baseURL + url + '/cancel-accept/'+data.id,
method: 'post',
// params: data
})
}
//任务流程——打开
export function open(url, data) {
return request({
url: baseURL + url + '/open/'+data.id,
method: 'post',
// params: data
})
}

337
PC/InterFace.Dash/src/components/News/dialogIndex.vue

@ -1,337 +0,0 @@
<template>
<!-- v-if="errorLogs.length>0" -->
<div>
<el-dialog :visible.sync="dialogVisible" width="80%" top="8vh" append-to-body>
<div slot="title">
<span style="padding-right: 10px;">消息列表</span>
</div>
<el-row :gutter="20">
<el-col :span="12">
<el-table
v-loading="hasReadLoading"
:data="tableDataHasRead"
height="400"
style="width: 100%"
@sort-change="sortChange"
@row-click="handleRowHasReadClick"
>
<el-table-column
prop="title"
label="标题"
width="180"
align="center"
sortable="custom"
:show-overflow-tooltip="true"
/>
<el-table-column
prop="hasRead"
label="状态"
align="center"
sortable="custom"
>
<template slot-scope="scope" >
<span v-if="scope.row.hasRead == true">已读</span>
<span v-else-if="scope.row.hasRead == false">未读</span>
</template>
</el-table-column>
<el-table-column
prop="readTime"
label="已读时间"
width="180"
align="center"
sortable="custom"
:show-overflow-tooltip="true"
/>
</el-table>
</el-col>
<el-col :span="12">
<el-table
v-loading="notReadLoading"
:data="tableData"
height="400"
style="width: 100%"
@sort-change="sortChange"
@row-click="handleRowClick"
>
<el-table-column
prop="title"
label="标题"
width="180"
align="center"
sortable="custom"
:show-overflow-tooltip="true"
/>
<el-table-column
prop="hasRead"
label="状态"
align="center"
sortable="custom"
>
<template slot-scope="scope" >
<span v-if="scope.row.hasRead == true">已读</span>
<span v-else-if="scope.row.hasRead == false">未读</span>
</template>
</el-table-column>
<el-table-column
prop="creationTime"
label="创建时间"
width="180"
align="center"
sortable="custom"
:show-overflow-tooltip="true"
/>
</el-table>
</el-col>
</el-row>
<!-- <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> -->
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="close"> </el-button>
<!-- <el-button type="primary" @click="dialogVisible = false"> </el-button> -->
</span>
<el-dialog
width="30%"
:title="details.titleDialog"
:visible.sync="innerVisible"
append-to-body>
<el-descriptions direction="vertical" :column="2" border v-loading="DialogLoading">
<el-descriptions-item label="消息标题">{{details.title}}</el-descriptions-item>
<el-descriptions-item label="内容">{{details.content}}</el-descriptions-item>
<el-descriptions-item label="消息类别">{{details.messageType}}</el-descriptions-item>
<el-descriptions-item label="创建时间">{{details.sendTime}}</el-descriptions-item>
</el-descriptions>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="innerVisible = false"> </el-button>
</span>
</el-dialog>
</el-dialog>
</div>
</template>
<script>
import { userNotifyNotReadList, userNotifyHasRead, userNotifyMessageUpdate, notifyMessage, getPageList } from "@/api/wms-api"
import { formatTimeStrToStr } from "@/utils/formatTime"
export default {
name: 'News',
data() {
return {
userId: '',
innerVisible: false,
details: {
titleDialog: '',
title: '',
content: '',
messageType: '',
sendTime: ''
},
hasReadLoading: false,
notReadLoading: false,
DialogLoading: false,
//
total: 0,
//
queryInfo: {
//
currentPage: 1,
//
pagesize: 20,
Sorting: "",
},
tableData: [],
tableDataHasRead:[],
}
},
props:{
dialogVisible: {
type: Boolean,
default: () => {
return false
}
},
},
computed: {
errorLogs() {
return this.$store.getters.errorLogs
}
},
mounted () {
this.userId = this.$store.getters.currentUserInfo.id
// todo-new:
// this.getList()
},
methods: {
getList(){
// ---------------
this.notReadLoading = true
userNotifyNotReadList(this.userId).then(res => {
this.tableData = res
this.tableData.forEach(item => {
if (item.creationTime) {
item.creationTime = formatTimeStrToStr(item.creationTime)
}
})
this.notReadLoading = false
}).catch(err => {
console.log(err)
this.notReadLoading = false
})
// ---------------
this.hasReadLoading = true
userNotifyHasRead(this.userId).then(res => {
this.tableDataHasRead = res
this.tableDataHasRead.forEach(item => {
if (item.readTime) {
item.readTime = formatTimeStrToStr(item.readTime)
}
})
this.hasReadLoading = false
}).catch(err => {
console.log(err)
this.hasReadLoading = false
})
},
//
handleSizeChange(val) {
this.queryInfo.pagesize = val;
this.getList();
},
//
handleCurrentChange(val) {
this.queryInfo.currentPage = val;
this.getList();
},
//
sortChange(data) {
const { prop, order } = data;
if (!prop || !order) {
this.queryInfo.Sorting = "";
this.handleFilter();
return;
}
this.queryInfo.Sorting = prop + " " + order;
this.handleFilter();
},
//table
handleRowClick(row, column, event) {
let that = this
this.innerVisible = true
this.details.titleDialog = row.title
this.DialogLoading = true
notifyMessage({id: row.messageId}, row.messageId).then(res => {
this.details.title = res.title
this.details.content = res.content
this.details.messageType = res.messageType
this.details.sendTime = formatTimeStrToStr(res.sendTime)
//
let params = {
sorting: null,
maxResultCount: 1000,
skipCount: 0,
condition: {
filters: null
}
}
getPageList(params,'message/message-type').then(resType => {
resType.items.forEach(item => {
if (item.messageTypeCode == res.messageType) {
that.details.messageType = item.messageTypeName
}
})
this.DialogLoading = false
}).catch(err => {
this.DialogLoading = false
console.log(err)
})
userNotifyMessageUpdate(row.id).then(res => {
that.getList();
that.$emit('getNoReadCount', that.userId)
}).catch(err => {
this.notReadLoading = false
console.log(err)
})
}).catch(err => {
console.log(err)
this.DialogLoading = false
})
// this.$router.push('/taskManage/InspectJob')
},
handleRowHasReadClick(row, column, event) {
let that = this
this.innerVisible = true
this.details.titleDialog = row.title
this.DialogLoading = true
notifyMessage({id: row.messageId}, row.messageId).then(res => {
this.details.title = res.title
this.details.content = res.content
this.details.messageType = res.messageType
this.details.sendTime = formatTimeStrToStr(res.sendTime)
//
let params = {
sorting: null,
maxResultCount: 1000,
skipCount: 0,
condition: {
filters: null
}
}
getPageList(params,'message/message-type').then(resType => {
resType.items.forEach(item => {
if (item.messageTypeCode == res.messageType) {
that.details.messageType = item.messageTypeName
}
})
this.DialogLoading = false
}).catch(err => {
console.log(err)
this.DialogLoading = false
})
}).catch(err => {
console.log(err)
this.DialogLoading = false
})
},
close() {
this.$emit('close')
}
}
}
</script>
<style lang="scss" scoped>
.message-title {
font-size: 16px;
color: #333;
font-weight: bold;
padding-right: 8px;
}
.Footer {
padding: 40px 40px;
display: flex;
justify-content: flex-end;
::v-deep button {
background-color: #fff;
}
::v-deep .number {
background-color: #fff;
}
}
</style>

64
PC/InterFace.Dash/src/components/News/index.vue

@ -1,64 +0,0 @@
<template>
<!-- v-if="errorLogs.length>0" -->
<div>
<el-badge v-if="this.noReadCount > 0" :value="this.noReadCount" :max="99" style="line-height: 10px;margin-right:10px" @click.native="dialogClick">
<svg-icon icon-class="email" />
</el-badge>
<svg-icon icon-class="email" v-if="this.noReadCount == 0" @click.native="dialogClick"/>
<dialogIndex :dialogVisible="dialogVisible" @close="close" @getNoReadCount="getNoReadCount"></dialogIndex>
</div>
</template>
<script>
import { userNotifyHasRead, userNotifyNotReadList, userNotifyMessageUpdate, notifyMessage, getPageList } from "@/api/wms-api"
import dialogIndex from "@/components/News/dialogIndex"
import { updateVersion } from '@/utils/upDateVersion'
export default {
name: 'News',
data() {
return {
dialogVisible: false,
noReadCount: 0
}
},
components: {
dialogIndex
},
mounted () {
this.userId = this.$store.getters.currentUserInfo.id
this.getNoReadCount(this.userId)
this.getSetInterval()
//
updateVersion()
},
methods: {
getSetInterval() {
let that = this
setInterval(function () {
that.getNoReadCount(that.userId)
//
updateVersion()
},120000)
},
getNoReadCount(userId) {
let that = this
// todo-new:
that.noReadCount = 0
// userNotifyNotReadList(userId).then(res => {
// that.noReadCount = res.length
// }).catch(err => {
// console.log(err)
// })
},
dialogClick(){
this.dialogVisible=true
},
close() {
this.dialogVisible = false
}
}
}
</script>
<style lang="scss" scoped>
</style>

1
PC/InterFace.Dash/src/components/UploadExcel/index.vue

@ -97,7 +97,6 @@
<script>
import XLSX from 'xlsx'
import { mixins } from "@/mixins/mixins"
import {SupplierAsnCtypeStaBack} from "@/filters/status"
export default {
name:"UploadExcel",

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

@ -66,7 +66,7 @@
</el-descriptions>
</template>
<script>
import { parseTime } from "@/utils/index"
import { parseTime } from "@/utils/formatTime"
import { formatTimeStrToStr } from "@/utils/formatTime"
import { fileStorage } from "@/api/wms-api"

20
PC/InterFace.Dash/src/components/filterForDetailPage/index.vue

@ -126,8 +126,6 @@ import { TableHeaderMixins } from "@/mixins/TableHeaderMixins";
import { LoadingMixins } from "@/mixins/LoadingMixins";
import { mixins } from "@/mixins/mixins";
import { filterSelectMixins } from '@/mixins/filter-Select'
// import { TestSchoolDetailList,TestSchoolDetailList_delete } from "@/api/wms-interface"
import * as interfaceApi from "@/api/wms-interface"
import {getListDesById,getPageListForDetail} from "@/api/wms-api"
import * as allUrlOption from '@/utils/baseData/urlOption'
export default {
@ -306,15 +304,15 @@ export default {
deleteHandleForDetail(data){
this.Loading.appMainLoading = true
data.deleteTipVisible = false
interfaceApi[this.DeleteApi](data.id).then(res => {
this.$successMsg('删除成功!')
this.oldSkipCount = 1
this.Loading.appMainLoading = false
this.paging()
}).catch(err => {
this.Loading.appMainLoading = false
this.$message.error("删除失败!")
})
// interfaceApi[this.DeleteApi](data.id).then(res => {
// this.$successMsg('!')
// this.oldSkipCount = 1
// this.Loading.appMainLoading = false
// this.paging()
// }).catch(err => {
// this.Loading.appMainLoading = false
// this.$message.error("!")
// })
},
}
}

2
PC/InterFace.Dash/src/filters/index.js

@ -3,7 +3,7 @@ export {
parseTime,
formatTime
}
from '@/utils'
from '@/utils/formatTime'
import * as statusType from "./statusType"
/**
* Show plural label if time is plural number

2400
PC/InterFace.Dash/src/filters/status.js

File diff suppressed because it is too large

56
PC/InterFace.Dash/src/lang/index.js

@ -1,56 +0,0 @@
import Vue from 'vue'
import VueI18n from 'vue-i18n'
import Cookies from 'js-cookie'
// import elementEnLocale from 'element-ui/lib/locale/lang/en' // element-ui lang
import elementZhLocale from 'element-ui/lib/locale/lang/zh-CN'// element-ui lang
// import elementEsLocale from 'element-ui/lib/locale/lang/es'// element-ui lang
// import elementJaLocale from 'element-ui/lib/locale/lang/ja'// element-ui lang
// import enLocale from './en'
import zhLocale from './zh'
// import esLocale from './es'
// import jaLocale from './ja'
Vue.use(VueI18n)
const messages = {
// en: {
// ...enLocale,
// ...elementEnLocale
// },
zh: {
...zhLocale,
...elementZhLocale
},
// es: {
// ...esLocale,
// ...elementEsLocale
// },
// ja: {
// ...jaLocale,
// ...elementJaLocale
// }
}
export function getLanguage() {
const chooseLanguage = Cookies.get('language')
if (chooseLanguage) return chooseLanguage
// if has not choose language
const language = (navigator.language || navigator.browserLanguage).toLowerCase()
const locales = Object.keys(messages)
for (const locale of locales) {
if (language.indexOf(locale) > -1) {
return locale
}
}
//return 'en'
return 'zh'
}
const i18n = new VueI18n({
// set locale
// options: en | zh | es
locale: getLanguage(),
// set locale messages
messages
})
export default i18n

118
PC/InterFace.Dash/src/lang/zh.js

@ -1,118 +0,0 @@
export default {
// 字段通用
ColumsPublic:{
id:'ID',
remark:'备注',
description:'描述',
status:'状态',
type:'类型',
creationTime:'创建时间',
creatorId:'创建者ID',
lastModificationTime:'上次修改时间',
lastModifierId:'上次修改者ID',
beginTime:'开始时间',
endTime:'结束时间',
operation:'操作',
},
// 所有字段(除了接口监控看板)
ColumsNames:{
itemCode:'物品代码',
itemName:'物品名称',
itemDesc1:'物品描述',
itemDesc2:'物品描述2',
abcClass:'ABC类',
canMake:'制造件',
canBuy:'采购件',
canOutsourcing:'外包件',
isRecycled:'回收件',
isPhantom:'是否虚拟物件',
productLine:'产品类',
elevel:'Elevel',
color:'颜色',
category:'种类',
group:'分组',
configuration:'配置',
basicUom:'基本计量单位',
stdPackQty:'标包数',
project:'项目',
version:'版本',
eco:'工程变革',
validity:'有效期',
validityUnit:'有效期单位',
manageType:'管理类型',
supplierCode:'供应商代码',
inspectType:'检验类型',
categoryCode:'分类代码',
categoryValue:'分类值',
packCode:'包装代码',
packName:'包装名称',
packType:'包装类型',
packQty:'包装数量',
packBasicUom:'包装计量单位',
ceilingQty:'数量上限',
floorQty:'数量下限',
isUsePercent:'使用百分比',
samplePercent:'抽检百分比',
sampleQty:'抽检数量',
productCode:'父物品号',
componentCode:'子物品号',
componentQty:'子物品用量',
componentUom:'子物品用量单位',
erpOp:'ERP工序',
mfgOp:'制造工序',
distributionType:'配送方式',
truncType:'取整方式',
plannedSplitRule:'计划拆分规则',
layer:'层级',
tenantId:'事务ID',
customerCode:'客户代码',
customerName:'客户名称',
customerShortName:'客户简称',
customerItemCode:'客户物品代码',
customerPackQty:'客户包装数量',
customerPackUom:'客户包装数量单位',
customerAdrName:'客户地址名称',
customerAdrCode:'客户地址代码',
contact:'联系人',
phone:'电话',
fax:'传真',
postID:'邮编',
address:'地址',
country:'国家',
city:'城市',
currency:'货币',
warehouseCode:'仓库',
locationCode:'库位代码',
projectCode:'项目代码',
projectName:'项目名称',
},
// 接口监控看板
// 现使用接口数据:config文件中【interfaceBoardUrl】+【interfaceBoardColumnsApi】地址
// ColumsDashboard:{
// number:'编号',
// dataType:'数据类型',
// tableType:'数据表类型',
// dataAction:'数据动作',
// effectiveDate:'生效时间',
// status:'数据状态',
// dataIdentityCode:'数据识别码',
// dataContent:'数据内容',
// sourceSystem:'来源系统',
// sourceDataId:'来源数据ID',
// sourceDataGroupCode:'来源数据组码',
// sourceDataDetailCode:'来源数据明细码',
// sourceDataContent:'来源数据内容',
// writeTime:'写入时间',
// writer:'写入者',
// destinationSystem:'目标系统',
// destinationDataId:'目标数据ID',
// destinationDataContent:'目标数据内容',
// readTime:'读取时间',
// reader:'读取者',
// errorCode:'错误代码',
// errorMessage:'错误信息',
// retryTimes:'重试次数',
// }
}

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

@ -16,8 +16,6 @@
<screenfull id="screenfull" class="right-menu-item hover-effect" />
<News class="right-menu-item hover-effect" />
<!-- <el-tooltip content="Global Size" effect="dark" placement="bottom">
<size-select id="size-select" class="right-menu-item hover-effect" />
</el-tooltip> -->
@ -58,7 +56,6 @@ import ErrorLog from "@/components/ErrorLog";
import Screenfull from "@/components/Screenfull";
import SizeSelect from "@/components/SizeSelect";
import Search from "@/components/HeaderSearch";
import News from "@/components/News";
export default {
components: {
@ -68,7 +65,6 @@ export default {
Screenfull,
SizeSelect,
Search,
News
},
computed: {
...mapGetters(["sidebar", "avatar", "device"]),

2
PC/InterFace.Dash/src/main.js

@ -6,7 +6,6 @@ import App from './App'
import store from './store'
import router from './router'
import watchLocal from '@/utils/watcLlocalstorage'//用于监听本地缓存
import i18n from './lang'
import "./utils/utils"
@ -71,6 +70,5 @@ new Vue({
el: '#app',
router,
store,
i18n,
render: h => h(App)
})

235
PC/InterFace.Dash/src/mixins/drawerMixins.js

@ -1,19 +1,10 @@
import {
postDelete,
processRequest,
getDetailed,
postExportForDetail,
fileStorage
} from '@/api/wms-api'
import requestDataNames from "@/utils/processButtonData"
import * as allUrlOption from '@/utils/baseData/urlOption'
import {
accept,
close,
cancel,
cancelAccept,
open
} from '@/api/wms-job'
export const drawerMixins = {
data() {
return {
@ -56,195 +47,8 @@ export const drawerMixins = {
this.editFormData.beginTime = new Date(this.propsData.beginTime)
this.editFormData.endTime = new Date(this.propsData.endTime)
}
// this.$listAssign(this.editFormData, this.propsData)
this.displayDialog.editDialog = true
}
// 申请业务 流程按钮实现
// 【提交】操作
if (val == requestDataNames.submit) {
that.Loading.appMainLoading = true
processRequest(that.propsData.id, that.URLOption_base + '/submit/').then(res => {
that.$successMsg('已提交')
getDetailed(that.propsData.id, that.URLOption_base).then(res => {
that.propsData = res
})
that.paging()
that.Loading.appMainLoading = false
}).catch(err => {
console.log(err)
that.Loading.appMainLoading = false
})
}
// 【审批】操作
else if (val == requestDataNames.agree) {
that.Loading.appMainLoading = true
processRequest(that.propsData.id, that.URLOption_base + '/agree/').then(res => {
that.$successMsg('已同意')
getDetailed(that.propsData.id, that.URLOption_base).then(res => {
that.propsData = res
})
that.paging()
that.Loading.appMainLoading = false
}).catch(err => {
console.log(err)
that.Loading.appMainLoading = false
})
}
// 【处理】操作
else if (val == requestDataNames.handle) {
that.Loading.appMainLoading = true
processRequest(that.propsData.id, that.URLOption_base + '/handle/').then(res => {
that.$successMsg('处理完成')
getDetailed(that.propsData.id, that.URLOption_base).then(res => {
that.propsData = res
})
that.paging()
that.Loading.appMainLoading = false
}).catch(err => {
console.log(err)
that.Loading.appMainLoading = false
})
}
// 【执行】操作
else if (val == requestDataNames.againHandle) { // 针对部分完成情况下,再次执行任务操作
that.Loading.appMainLoading = true
processRequest(that.propsData.id, that.URLOption_base + '/handle/').then(res => {
that.$successMsg('执行成功')
getDetailed(that.propsData.id, that.URLOption_base).then(res => {
that.propsData = res
})
that.paging()
that.Loading.appMainLoading = false
}).catch(err => {
console.log(err)
that.Loading.appMainLoading = false
})
}
// 【中止】操作
else if (val == requestDataNames.abort) {
that.Loading.appMainLoading = true
processRequest(that.propsData.id, that.URLOption_base + '/abort/').then(res => {
that.$successMsg('已中止')
getDetailed(that.propsData.id, that.URLOption_base).then(res => {
that.propsData = res
})
that.paging()
that.Loading.appMainLoading = false
}).catch(err => {
console.log(err)
that.Loading.appMainLoading = false
})
}
// 【执行完成】操作
else if (val == 'completeRequest') {
that.Loading.appMainLoading = true
processRequest(that.propsData.id, that.URLOption_base + '/complete/').then(res => {
that.$successMsg('执行完成')
getDetailed(that.propsData.id, that.URLOption_base).then(res => {
that.propsData = res
})
that.paging()
that.Loading.appMainLoading = false
}).catch(err => {
console.log(err)
that.Loading.appMainLoading = false
})
}
// 【取消】操作
else if (val == requestDataNames.cancel) {
that.Loading.appMainLoading = true
processRequest(that.propsData.id, that.URLOption_base + '/cancel/').then(res => {
that.$successMsg('已取消')
getDetailed(that.propsData.id, that.URLOption_base).then(res => {
that.propsData = res
})
that.paging()
that.Loading.appMainLoading = false
}).catch(err => {
console.log(err)
that.Loading.appMainLoading = false
})
}
// 【驳回】操作
else if (val == requestDataNames.refuse) {
that.Loading.appMainLoading = true
processRequest(that.propsData.id, that.URLOption_base + '/refuse/').then(res => {
that.$successMsg('已驳回')
getDetailed(that.propsData.id, that.URLOption_base).then(res => {
that.propsData = res
})
that.paging()
that.Loading.appMainLoading = false
}).catch(err => {
console.log(err)
that.Loading.appMainLoading = false
})
}
// 任务 流程按钮实现
if (val == 'acceptJob') {
that.Loading.appMainLoading = true
accept(that.URLOption_base, {id: that.propsData.id}).then(res => {
that.$successMsg('已接任务')
that.Loading.appMainLoading = false
getDetailed(that.propsData.id, that.URLOption_base).then(res => {
that.propsData = res
})
that.paging();
}).catch(err => {
that.Loading.appMainLoading = false
})
} else if(val == 'closeJob'){
that.Loading.appMainLoading = true
close(that.URLOption_base, {id: that.propsData.id}).then(res => {
that.$successMsg('已关闭任务')
that.Loading.appMainLoading = false
getDetailed(that.propsData.id, that.URLOption_base).then(res => {
that.propsData = res
})
that.paging();
}).catch(err => {
that.Loading.appMainLoading = false
})
} else if(val == 'invalidJob'){
that.Loading.appMainLoading = true
cancel(that.URLOption_base, {id: that.propsData.id}).then(res => {
that.$successMsg('已作废任务')
that.Loading.appMainLoading = false
getDetailed(that.propsData.id, that.URLOption_base).then(res => {
that.propsData = res
})
that.paging();
}).catch(err => {
that.Loading.appMainLoading = false
})
} else if(val == 'cancelAcceptJob'){
that.Loading.appMainLoading = true
cancelAccept(that.URLOption_base, {id: that.propsData.id}).then(res => {
that.$successMsg('已取消接受任务')
that.Loading.appMainLoading = false
getDetailed(that.propsData.id, that.URLOption_base).then(res => {
that.propsData = res
})
that.paging();
}).catch(err => {
that.Loading.appMainLoading = false
})
} else if(val == 'openJob'){
that.Loading.appMainLoading = true
open(that.URLOption_base, {id: that.propsData.id}).then(res => {
that.$successMsg('已打开任务')
that.Loading.appMainLoading = false
getDetailed(that.propsData.id, that.URLOption_base).then(res => {
that.propsData = res
})
that.paging();
}).catch(err => {
that.Loading.appMainLoading = false
})
} else if(val == 'handleJob'){
// 请在主页写相关执行任务操作代码
console.log('请在主页写相关执行任务操作代码')
}
},
//抽屉下拉按钮操作
async drawerHandle(val) {
@ -269,39 +73,7 @@ export const drawerMixins = {
}).catch(() => {
this.Loading.appMainLoading = false
});
} else if (val == 'print') {
this.Loading.appMainLoading = true
// this.Print(this.printData(this.propsData)).then(resolve=>{
this.Print(this.printData(this.tableDataDetails)).then(resolve=>{
this.Loading.appMainLoading = false
},reject=>{
this.Loading.appMainLoading = false
}).catch(() => {
this.Loading.appMainLoading = false
});
} else if (val == 'tuoPrint') {
this.Loading.appMainLoading = true
// let obj = await this.tuoPrintData(this.propsData)
let obj = await this.tuoPrintData(this.tableDataDetails)
this.Print(obj).then(resolve=>{
this.Loading.appMainLoading = false
},reject=>{
this.Loading.appMainLoading = false
}).catch(() => {
this.Loading.appMainLoading = false
});
} else if (val == 'xbqPrint') {
this.Loading.appMainLoading = true
// let obj = await this.xbqPrintData(this.propsData)
let obj = await this.xbqPrintData(this.tableDataDetails)
this.Print(obj).then(resolve=>{
this.Loading.appMainLoading = false
},reject=>{
this.Loading.appMainLoading = false
}).catch(() => {
this.Loading.appMainLoading = false
});
}
}
},
// 导出
exportForDetailHandle(that,url,params){
@ -313,11 +85,6 @@ export const drawerMixins = {
PageListParams.route = url;
postExportForDetail(PageListParams,url,params).then(res => {
this.blob(res, this.$route.meta.title )//使用前端导出名称
// fileStorage({blobName: res.blobName}).then( fileStorageRes => {
// that.downloadFile(fileStorageRes.bytes, fileStorageRes.fileName)
// }).catch( err => {
// console.log(err)
// })
that.Loading.appMainLoading = false
}).catch(err => {
that.Loading.appMainLoading = false

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

@ -1,9 +1,6 @@
import {
PrintServices,
postImportDown,
postImport,
fileStorage,
fileStorageCreate
} from '@/api/wms-api'
import * as allUrlOption from '@/utils/baseData/urlOption'
export const mixins = {
@ -15,11 +12,7 @@ export const mixins = {
editOptions: {
options: [], //autoComplete显示数据|| select显示数据(拉取)
// whetherOrNot: this.$staticOptions.WhetherOrNot(),
// openToClose: this.$staticOptions.OpenToClose(),
// week: this.$staticOptions.Week(),
// inspectType: this.$staticOptions.InspectType(),
// whetherOrNot: this.$staticOptions.WhetherOrNot(),
// storeRelationType: this.$staticOptions.storeRelationType(),
// QtyUom: this.$staticOptions.QtyUom(),
},
//表头 从本地缓存获取字段设置,如果没有,从js中获取 todo:优化数据
@ -124,34 +117,6 @@ export const mixins = {
}
// this.displayDialog.AddNewDialog = true
},
//子表操作
childTable(e, val) {
let UrlData = {
detailId: val.row.id
}
switch (e.target.innerHTML) {
case "删除":
this.$confirm('您确定删除吗, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (this.formReveal) {
this.CreateFormData.details.splice(val.$index, 1)
} else {
// postDetailDelete(this.propsData.id, UrlData, this.URLOption_base).then(res => {
// this.editFormData.details.splice(val.$index, 1)
// })
this.editFormData.details.splice(val.$index, 1)
}
}).catch(() => {
});
break;
case "确定":
postDetailUpdate(val.row, this.propsData.id, UrlData, this.URLOption_base).then(res => {})
}
},
//步骤新增OR编辑结束退出
stepsClose(val) {
// this.FormRemove(val[0]);
@ -168,35 +133,6 @@ export const mixins = {
resolve()
})
},
//打印标签
Print(val) {
let that = this
if(!val){
that.$warningMsg('暂无可打印数据')
return
}
const loading = this.$loading({
lock: true,
text: 'Loading',
});
return new Promise((resolve, reject) => {
PrintServices(val).then(res => {
// console.log(process.env.VUE_APP_PRINT_API + '/' + res)
// window.open(process.env.VUE_APP_PRINT_API + '/' + res)
// window.open('http://10.74.150.81:9082' + '/' + res)
//杭州
// const BaseURL = localStorage.getItem('base') + '/' + res
// window.open(BaseURL)
const PrintURL = localStorage.getItem('print') + '/' + res
window.open(PrintURL)
loading.close()
resolve()
}).catch(err => {
loading.close()
reject()
})
})
},
//导出存储-新
blob(res, fileName) {
let blob = new Blob([res], {
@ -295,138 +231,6 @@ export const mixins = {
});
}
},
// downloadFile(data, fileName) {
// var byteString = atob(data)
// var arrayBuffer = new ArrayBuffer(byteString.length) // 创建缓冲数组
// var intArray = new Uint8Array(arrayBuffer) // 创建视图
// for (var i = 0; i < byteString.length; i++) {
// intArray[i] = byteString.charCodeAt(i)
// }
// const blob = new Blob([intArray], { type: '' })
// // 获取heads中的filename文件名
// const downloadElement = document.createElement('a')
// // 创建下载的链接
// const href = window.URL.createObjectURL(blob)
// downloadElement.href = href
// // 下载后文件名
// downloadElement.download = fileName
// document.body.appendChild(downloadElement)
// // 点击下载
// downloadElement.click()
// // 下载完成移除元素
// document.body.removeChild(downloadElement)
// // 释放掉blob对象
// window.URL.revokeObjectURL(href)
// },
//导入文件-旧
// postImportMergeClick(val) {
// let that = this
// let menuName = this.$route.meta.title
// if (val[0][0] == 0) {
// that.FormRemove(val[0]);
// that.displayDialog.importDialog = false;
// } else {
// val[0][1].validate((valid) => {
// if (valid) {
// that.Loading.importLoading = true;
// let {
// formFile
// } = val[1]
// let fd = new FormData();
// let fileName = ''
// let rd = new FileReader(); // 创建文件读取对象
// // formFile.forEach((item) => {
// // fd.append("formFile", item)
// // fd.append("method", val[1].method)
// // fd.append("isAllowPartImport", val[1].isAllowPartImport=='0'?true:false)
// // })
// // 目前只有单文件上传,写法只适用于单文件上传
// fileName = formFile[0].name
// rd.readAsDataURL(formFile[0])
// rd.onloadend = function(){
// var arrayBuffer = rd.result
// let params = {
// fileName: fileName,
// bytes: arrayBuffer.substring(arrayBuffer.indexOf(',') + 1, arrayBuffer.length)
// }
// // 特殊导入接口判断
// let _uploadURL = that.importUploadURL || that.URLOption_base
// let _isSpecial = that.importUploadURL ? true : false
// fileStorageCreate(params).then( createRes => {
// let importParams = {
// fileType: 1, //文件类型 固定1
// method: val[1].method, //导入方式 0 更新 1 追加 2 覆盖
// isAllowPartImport: val[1].isAllowPartImport=='0'?true:false, //是否部分错误导入
// route: _isSpecial ? _uploadURL : _uploadURL + '/import', //路由
// function: menuName, //菜单名
// blobName: createRes,
// company: window.SITE_CONFIG['company']
// }
// postImport(importParams, _uploadURL, _isSpecial).then(res => {
// // 判断是否有错误记录
// if (res.errorNum > 0) {
// that.$alert('发现导入错误数据共:' + res.errorNum + '条', '错误报告', {
// confirmButtonText: '下载错误报告',
// callback: action => {
// if (action == 'confirm') {
// fileStorage({blobName: res.fileCode}).then( fileStorageRes => {
// that.downloadFile(fileStorageRes.bytes, fileStorageRes.fileName)
// }).catch( err => {
// console.log(err)
// })
// }
// }
// })
// } else if (res.exceptionMessage != null) {
// that.$alert('错误信息:' + res.exceptionMessage, '错误', {
// confirmButtonText: '确定',
// callback: action => {
// }
// })
// // that.$alert('导入模板错误,请导入正确的模板文件!', '模板错误', {
// // confirmButtonText: '确定',
// // callback: action => {
// // }
// // })
// } else {
// // that.$successMsg('全部导入成功')
// that.$alert('全部导入成功,是否下载导入报告', '导入报告', {
// confirmButtonText: '下载导入报告',
// cancelButtonText: '取消',
// callback: action => {
// if (action == 'confirm') {
// fileStorage({blobName: res.fileCode}).then( fileStorageRes => {
// that.downloadFile(fileStorageRes.bytes, fileStorageRes.fileName)
// }).catch( err => {
// console.log(err)
// })
// }
// }
// })
// }
// that.Loading.importLoading = false
// that.FormRemove(val[0]);
// that.displayDialog.importDialog = false;
// that.paging()
// }).catch(err => {
// that.Loading.importLoading = false
// that.FormRemove(val[0]);
// that.displayDialog.importDialog = false;
// that.paging()
// })
// }).catch(err => {
// console.log(err)
// })
// }
// } else {
// that.$errorMsg('请按照提示继续操作')
// that.displayDialog.importDialog = false;
// return false;
// }
// });
// }
// },
//导入模板下载
importDown(url) {
let _url = url ? url : this.URLOption_base
@ -440,4 +244,4 @@ export const mixins = {
val[1].resetFields();
},
}
}
}

330
PC/InterFace.Dash/src/mixins/printMixin.js

@ -1,330 +0,0 @@
// 打印功能数据整合
import { Enum } from "@/utils/index"
import store from '@/store/index'
/**/
// 打印【箱标签-单个】 (xiangbq.rdlx)
// 使用位置:补打标签 (RepairLabels.vue)
/**
* @param {*} propsData 必填 详情数据 示例this.propsData
* @param {*} options 自定义特殊配置值 示例{'number':'poNumber'} (number值将传为poNumber)
* @param {*} name reportName
* @param {*} url dataUrl
* @returns
*/
export function initPrintPackingCodeData(propsData,options,name,url){
if(!propsData || propsData.details.length <= 0)return {}
let _printData = {
"boxlabel":[]
}
let _options = options ? options : {}
propsData.details.forEach((item,key) => {
_printData["boxlabel"].push({
"title":propsData[_options.title] || propsData.title || "FATY 物品发运单",//title
"supplierSimpleName": propsData[_options.supplierSimpleName] || propsData.supplierSimpleName,//供应商名称
"supplierCode": propsData[_options.supplierCode] || propsData.supplierCode,//供应商代码
"poNumber": propsData[_options.poNumber] || propsData.poNumber,//订单号
"asnNumber": propsData[_options.asnNumber] || propsData.asnNumber,//发货单号
"remark": propsData[_options.remark] || propsData.remark,//备注
"planArriveDate":propsData[_options.planArriveDate] || propsData.planArriveDate,//要求到货时间
// "contacts": propsData[_options.contacts] || propsData.contacts,//客户名称 暂未使用
// "customerAddressCode":propsData[_options.customerAddressCode] || propsData.customerAddressCode,//客户地址 暂未使用
// "supplierName": propsData[_options.supplierName] || propsData.supplierName,//供应商名称 暂未使用
"details": [
{
"supplierItemName": item[_options.supplierItemName] || item.supplierItemName,//零件名(供应商零件名)
"supplierItemCode": item[_options.supplierItemCode] || item.supplierItemCode,//零件号(供应商零件号)
"specifications": item[_options.specifications] || item.specifications,//规格
"produceDate": item[_options.produceDate] || item.produceDate,//生产时间
"lot": item[_options.lot] || item.lot,//生产批次
"locationErpCode": item[_options.locationErpCode] || item.locationErpCode,//储位
"itemCode": item[_options.itemCode] || item.itemCode,//物品代码(ERP号)
"qty": item[_options.qty] || item.qty,//要货数量 + 整包数量
"packingCode": item[_options.packingCode] || item.packingCode,//条形码
"printIndex":item[_options.printIndex] || Number(key)+1,//打印序列
// "itemName": item[_options.itemName] || item.itemName,//物品名称 暂未使用
"stdPackQty": item[_options.stdPackQty] || item.stdPackQty,//整包数量 暂未使用
}
],
})
});
let data = {
reportName: name || 'xiangbq.rdlx',
dataUrl: url || 'ccc',
jsonData: JSON.stringify(_printData)
};
return data
}
//打印【箱标签-上下2个】(xiangbq_two.rdlx)
//使用位置:拆分箱标签 (splitLabels.vue)
/**
* @param {*} propsData 必填 详情数据 示例this.propsData
* @param {*} options 自定义特殊配置值 示例{'number':'poNumber'} (number值将传为poNumber)
* @param {*} name reportName
* @param {*} url dataUrl
* @returns
*/
export function initPrintPackingCodeTwoData(oldData,newData,options,name,url){
if(!oldData && !newData)return {}
let _printData = {}
let _options = options ? options : {}
// 上方信息
if(oldData){
_printData={
"oldTitle":oldData[_options.title] || oldData.title || "FATY 物品发运单",//上方_title
"oldSupplierSimpleName": oldData[_options.supplierSimpleName] || oldData.supplierSimpleName,//上方_供应商名称
"oldSupplierCode": oldData[_options.supplierCode] || oldData.supplierCode,//上方_供应商代码
"oldPoNumber": oldData[_options.poNumber] || oldData.poNumber,//上方_订单号
"oldAsnNumber": oldData[_options.asnNumber] || oldData.asnNumber,//上方_发货单号
"oldRemark": oldData[_options.remark] || oldData.remark,//上方_备注
"oldPlanArriveDate":oldData[_options.planArriveDate] || oldData.planArriveDate,//上方_要求到货时间
"oldSupplierItemName": oldData[_options.supplierItemName] || oldData.supplierItemName,//上方_零件名(供应商零件名)
"oldSupplierItemCode": oldData[_options.supplierItemCode] || oldData.supplierItemCode,//上方_零件号(供应商零件号)
"oldSpecifications": oldData[_options.specifications] || oldData.specifications,//上方_规格
"oldProduceDate": oldData[_options.produceDate] || oldData.produceDate,//上方_生产时间
"oldLot": oldData[_options.lot] || oldData.lot,//上方_生产批次
"oldLocationErpCode": oldData[_options.locationErpCode] || oldData.locationErpCode,//上方_储位
"oldItemCode": oldData[_options.itemCode] || oldData.itemCode,//上方_物品代码(ERP号)
"oldQty": oldData[_options.qty] || oldData.qty,//上方_要货数量
"oldStdPackQty": oldData[_options.stdPackQty] || oldData.stdPackQty,//上方_整包数量
"oldPackingCode": oldData[_options.packingCode] || oldData.packingCode,//上方_条形码
"oldPrintIndex":oldData[_options.printIndex] || 1,//上方_打印序列
..._printData
}
}
// 下方信息
if(newData){
_printData={
"newTitle":newData[_options.title] || newData.title || "FATY 物品发运单",//下方_title
"newSupplierSimpleName": newData[_options.supplierSimpleName] || newData.supplierSimpleName,//下方_供应商名称
"newSupplierCode": newData[_options.supplierCode] || newData.supplierCode,//下方_供应商代码
"newPoNumber": newData[_options.poNumber] || newData.poNumber,//下方_订单号
"newAsnNumber": newData[_options.asnNumber] || newData.asnNumber,//下方_发货单号
"newRemark": newData[_options.remark] || newData.remark,//下方_备注
"newPlanArriveDate":newData[_options.planArriveDate] || newData.planArriveDate,//下方_要求到货时间
"newSupplierItemName": newData[_options.supplierItemName] || newData.supplierItemName,//下方_零件名(供应商零件名)
"newSupplierItemCode": newData[_options.supplierItemCode] || newData.supplierItemCode,//下方_零件号(供应商零件号)
"newSpecifications": newData[_options.specifications] || newData.specifications,//下方_规格
"newProduceDate": newData[_options.produceDate] || newData.produceDate,//下方_生产时间
"newLot": newData[_options.lot] || newData.lot,//下方_生产批次
"newLocationErpCode": newData[_options.locationErpCode] || newData.locationErpCode,//下方_储位
"newItemCode": newData[_options.itemCode] || newData.itemCode,//下方_物品代码(ERP号)
"newQty": newData[_options.qty] || newData.qty,//下方_数量 + 整包数量
"newStdPackQty": newData[_options.stdPackQty] || newData.stdPackQty,//上方_整包数量
"newPackingCode": newData[_options.packingCode] || newData.packingCode,//下方_条形码
"newPrintIndex":newData[_options.printIndex] || 1,//下方_打印序列
..._printData
}
}
let data = {
reportName: name || 'xiangbq_two.rdlx',
dataUrl: url || 'ccc',
jsonData: JSON.stringify(_printData)
};
return data
}
// 打印【箱标签-单页4个】 (xiangbq_many.rdlx)
// 使用位置:半成品上架标签 (PartiallyPreparedProducts.vue) | 生产退库标签 (productionReturnLabel.vue)
// | 创建标签 (RecycledMaterialsLabel.vue) | 到货请求 (PurchaseReceiptRequest.vue)
/**
* @param {*} propsData 必填 详情数据 示例this.propsData
* @param {*} options 自定义特殊配置值 示例{'number':'poNumber'} (number值将传为poNumber)
* @param {*} name reportName
* @param {*} url dataUrl
* @returns
*/
export function initPrintPackingCodeManyData(propsData,options,name,url){
if(!propsData || propsData.details.length <= 0)return {}
let _printData = {
"boxlabel":[]
}
let _options = options ? options : {}
// 按4个分组数据
let newList = []
let chunk = 4;
propsData.details.forEach((item,key)=>{
item.printIndex = Number(key + 1)
})
for(var i = 0; i < propsData.details.length ;i+=chunk) {
newList.push(propsData.details.slice(i,i + chunk))
}
let _index = null
newList.forEach((item,key)=>{
let _label = {}
item.forEach((item2,key2)=>{
if(key2 == 0){
if(!_index){
_index = '0'
}else{
_index = Number(_index) + 1
}
}
let _title = propsData ? "FATY 物品发运单" : ""
_label['title'+Number(key2 + 1)]=propsData[_options.title] || propsData.title || _title,//title
_label['contacts'+Number(key2 + 1)]= propsData[_options.contacts] || propsData.contacts,//客户名称
_label['customerAddressCode'+Number(key2 + 1)]=propsData[_options.customerAddressCode] || propsData.customerAddressCode,//客户地址
_label['supplierCode'+Number(key2 + 1)]= propsData[_options.supplierCode] || propsData.supplierCode,//供应商代码
_label['supplierSimpleName'+Number(key2 + 1)]= propsData[_options.supplierSimpleName] || propsData.supplierSimpleName,//供应商名称(简称)
_label['remark'+Number(key2 + 1)]= propsData[_options.remark] || propsData.remark,//备注
_label['planArriveDate'+Number(key2 + 1)]=propsData[_options.planArriveDate] || propsData.planArriveDate,//要求到货时间
_label['poNumber'+Number(key2 + 1)]= propsData[_options.poNumber] || propsData.poNumber,//订单号
_label['asnNumber'+Number(key2 + 1)]= propsData[_options.asnNumber] || propsData.asnNumber,//发货单号
_label['supplierItemName'+Number(key2 + 1)] = item[_options.supplierItemName] || item2.supplierItemName;//零件名(供应商零件名)
_label['supplierItemCode'+Number(key2 + 1)] = item[_options.supplierItemCode] || item2.supplierItemCode;//零件号(供应商零件号)
_label['specifications'+Number(key2 + 1)] = item[_options.specifications] || item2.specifications;//规格
_label['produceDate'+Number(key2 + 1)] = item[_options.produceDate] || item2.produceDate;//生产时间
_label['lot'+Number(key2 + 1)] = item[_options.lot] || item2.lot;//生产批次
_label['locationErpCode'+Number(key2 + 1)] = item[_options.locationErpCode] || item2.locationErpCode;//储位
_label['itemCode'+Number(key2 + 1)] = item[_options.itemCode] || item2.itemCode;//物品代码(ERP号)
_label['stdPackQty'+Number(key2 + 1)] = item[_options.stdPackQty] || item2.stdPackQty;//整包数量 暂未使用
_label['qty'+Number(key2 + 1)] = item[_options.qty] || item2.qty;//要货数量 + 整包数量
_label['packingCode'+Number(key2 + 1)] = item[_options.packingCode] || item2.packingCode;//条形码
_label['printIndex'+Number(key2 + 1)] = item[_options.printIndex] || item2.printIndex;//序号
_printData.boxlabel[_index] = _label
})
})
let data = {
reportName: name || 'xiangbq_many.rdlx',
dataUrl: url || 'ccc',
jsonData: JSON.stringify(_printData)
};
return data
}
// 字典转义
const printEnumOption = {
UnqualifiedReason:{reportStr:'reasonStr',staName:'UnqualifiedReason',value:'reason'},
PurReturnReason:{reportStr:'reasonStr',staName:'PurReturnReason',value:'reason'},
Reason:{reportStr:'reasonStr',staName:'Reason',value:'reasonCode'},
AdjustmentReason:{reportStr:'reasonStr',staName:'AdjustmentReason',value:'reasonCode'},
}
/**/
// 打印【全部数据】
/**
* @param {*} propsData 必填 详情数据 示例this.propsData
* @param {*} name 必填 reportName
* @param {*} enumOption 选填 转义状态 如果是字符串直接走[printEnumOption]格式
* 如果自定义格式{reportStr:'报表中用到的值'staName:'localStorage中的名称'value:'要转义的detail中的值',label:"可不填,默认label"}
* @param {*} options 选填 自定义特殊配置值 示例{'number':'poNumber'} (number值将传为poNumber)
* @param {*} url 选填 dataUrl
* @returns
*/
//
export function initPrintAllData(propsData,name,enumOption,options,url){
if(!propsData || propsData.details.length <= 0)return false
let _printData = {details:[]}
let _outData = {}
for(var key in propsData){
if(key != 'details')_outData[key] = propsData[key]
if(options){
for(var op in options){
if(op != 'details')_outData[op] = propsData[options[op]]
}
}
}
_outData.title = propsData.title || ''
_outData.headerName = propsData.headerName || localStorage.getItem('companyName')
propsData.details.forEach((item,key) => {
// 序号
item.xh = Number(key) + 1;
// 特殊配置
if(options && options.details){
for(var op in options.details){
item[op] = item[options.details[op]]
}
}
// 转义字典
if(enumOption){
let _enumOption = (typeof enumOption == 'string') ? printEnumOption[enumOption] : enumOption
item[_enumOption.reportStr] = Enum(store.getters.dictionaries[_enumOption.staName], item[_enumOption.value] , _enumOption.label || 'label')
}
let _item = Object.assign({},item, _outData);
_printData.details.push(_item)
});
let data = {
reportName: name,
dataUrl: url || 'ccc',
jsonData: JSON.stringify(_printData)
};
return data
}
// 当前模板数据
/**todo:储位,预计量,字段确定 */
// cgshd.rdlx 使用参数
// 使用位置:采购收货记录-合格品收货明细tab页 (PurchaseReceiptNote-msQuery.vue)
// 发货单号:asnNumber; 制表日:creationTime; 供应商:supplierCode; 供应商简称:supplierShortName
// 物品代码:itemCode; 物品名称:itemName; 箱码:packingCode; 单位:uom; 数量:qty; 状态:statusStr; 不合格原因:reasonStr;
// thd.rdlx 使用参数
// 使用位置:上架前退货记录 (beforeGroundingReturnNote.vue) | 上架后退货记录 (purchaseReturn => returnNote.vue PurchaseReturnNote)
// 使用位置:采购收货记录-不合格品收货明细tab页 (PurchaseReceiptNote-msQuery.vue)
// 退货单号:number; 发货单号:asnNumber; 制表日:creationTime; 供应商:supplierCode; 供应商简称:supplierShortName
// 物品代码:itemCode; 物品名称:itemName; 箱码:packingCode; 单位:uom; 数量:qty; 退货原因:reasonStr;
// lineSideWarehouse.rdlx 使用参数
// 使用位置:线边仓调拨记录 (lineSideWarehouseAllocationNote.vue)
// 调拨单号:number; 参考单据:poNumber; 制表日:creationTime; 调拨部门:deptCode; 部门名称:deptName
// 物品代码:itemCode; 单位:uom; 预计调拨量:preQty; 调入储位:toLocationCode; 实际调拨量:qty; 调出储位:fromLocationCode;
// fscll.rdlx | fsctl.rdlx 使用参数
// 使用位置:非生产领料申请 (pickingRequest.vue - fscll.rdlx)
// 使用位置:非生产退料申请 (materialReturnRequest.vue - fsctl.rdlx)
// 单号:number; 参考单据:?; 制表日:creationTime; 部门代码:deptCode; 部门名称:deptName; 项目分类名称:projCapacityName; 专案代码:caseCode; 说明:remark
// 料品编号:itemCode; 品名:itemName; 单位:uom; 预计量:preQty; 实际量:qty; 储位:locationCode; 配置:configuration
// cwdbd.rdlx 使用参数
// 使用位置:储位调拨记录 (interStorageAllocationNote.vue)
// 调拨单号:number; 制表日:creationTime; 调拨日期:activeDate
// 物品代码:itemCode; 物品名称:itemName; 单位:uom; 调出储位:fromLocationCode; 调入储位:toLocationCode; 调拨量:qty;
// khcwdbd.rdlx 使用参数
// 使用位置:客户储位调拨记录 (customerStorageAllocationNote.vue)
// 调拨单号:number; 制表日:creationTime; 使用者:worker; 部门代码:deptCode; 客户储位:toLocationCode
// 序号:xh; 物品代码:itemCode; 物品名称:itemName; 预计调拨量:preQty; 实际调拨量:qty; 调出储位:fromLocationCode;
// xbcbfd.rdlx 使用参数
// 使用位置:线边仓报废记录 (lineSideWarehouseScrappingNote.vue)
// 报废单号:number; 制表日:creationTime;
// 物品代码:itemCode; 物品名称:itemName; 储位:fromLocationCode; 数量:qty; 原因说明:reasonStr; 参考单据:scrapRequestNumber;
// tzd.rdlx 使用参数
// 使用位置:线边仓调整记录 (lineSideWarehouseAdjustmentSheetNote.vue)
// 单号:number; 制表日:creationTime;
// 物品代码:itemCode; 物品名称:itemName; 储位:locationCode; 数量:adjustQty; 原因说明:reasonStr; 参考单据:requestNumber;
// xbcll.rdlx 使用参数
// 使用位置:?自动发料任务 (automaticCallJob-msQuery.vue) | 自动发料记录 (automaticCallNote.vue)
// 使用位置:人工发料任务 (IssueJob.vue) | 人工发料记录 (IssueNote.vue)
// 单号:number; 制表日:creationTime; 部门名称:deptName;
// 物品代码:itemCode; 物品名称:itemName; 物品描述:itemDesc1; 零件号:itemCode; 来源库位:fromLocationCode;
// 实际数量:qty; 单位:uom; 批次:fromLot; 调入储位:toLocationErpCode; 调出储位:fromLocationErpCode;
// xbctl.rdlx 使用参数 xbctl.rdlx报表 和 xbcll.rdlx报表 目前字段相同,除了领/退字段
// 使用位置:生产退库记录 (productionReturn => returnNote.vue productionReturnNote)
// zjfl.rdlx 使用参数
// 使用位置:直接发料记录 (directIssueNote.vue)
// 单号:number; 制表日:creationTime; 部门名称:deptName;
// 物品代码:itemCode; 物品名称:itemName; 物品描述:itemDesc1; 零件号:itemCode; 来源库位:fromLocationCode;
// 实际数量:qty; 单位:uom; 批次:fromLot; 调入储位:toLocationErpCode; 调出储位:fromLocationErpCode;
// hslrkd.rdlx 使用参数
// 使用位置:回收料收货记录 (materialsReceipt.vue recycledMaterialsReceipt)
// 入库单号:number; 制表日:creationTime; 入库日期:activeDate; 部门代码:deptCode; 部门名称:deptName;
// 物品代码:itemCode; 物品名称:itemName; 物品描述1:itemDesc1; 物品描述2:itemDesc2; 数量:qty; 储位:locationErpCode;
// chdmxb.rdlx 使用参数
// 使用位置:原料直发客户记录 (materialDirectSendNote.vue)
// 出货单号:number; 出货日期:deliverTime; 制表日:creationTime; 客户名称:customerCode; 客户地址:customerAddressCode;
// 序号:xh, 物品代码:itemCode; 物品名称:itemName; 单位:uom; 箱标签:packingCode, 出货数量:qty;
// ysd.rdlx 使用参数
// 使用位置:采购上架记录 (PutawayNote.vue)
// 供应商代码:supplierCode; 供应商名称:supplierSimpleName; 制表日:creationTime; 采购单:poNumber; 收货单号:receiptNumber; 验收口:dockCode; 请购部门:deptName;
// 物品代码:itemCode; 验收备注:remark; 厂商料品单号:supplierItemCode; 物品名称:itemName; 收料量:qty; 验收日期:arriveDate; 单位:uom; 储位:toLocationErpCode;

178
PC/InterFace.Dash/src/permission-0725.js

@ -1,178 +0,0 @@
import router from './router'
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 getPageTitle from '@/utils/get-page-title'
import { asyncRoutes } from '@/router'
import { login,getUsersByUserName } from "@/api/wms-auth"
NProgress.configure({
showSpinner: false
}) // NProgress Configuration
router.beforeEach(async (to, from, next) => {
// start progress bar
NProgress.start()
// set page title
document.title = getPageTitle()
// 获取枚举数据
if(!store.getters.enumList || store.getters.enumList.length <= 0){
await store.dispatch('definition/getDefinitionConfig')
}
// // 获取表头转义
// if(!store.getters.columZHList || store.getters.columZHList.length <= 0){
// await store.dispatch('definition/getColumZHList')
// }
// 判断是否自动登录
let isAutoLogin = JSON.parse(localStorage.getItem('isAutoLogin'))
const columZHList = store.getters.columZHList
// 如果路径中有isAutoLogin参数则优先,否则读取配置文件中的isAutoLogin参数
let _url_isAutoLogin = to.query.isAutoLogin
if( _url_isAutoLogin== 'false' || _url_isAutoLogin == 'true'){
isAutoLogin = JSON.parse(_url_isAutoLogin)
}
// 是否有用户信息:
const userInfo = store.getters.currentUserInfo
// 1、如果没有判断是否为自动登录(是自动登录则自动执行登录,账号密码为配置信息中的值,不是自动登录则跳到登录页)
// 2、有/没有:则检查是否有api接口的表头数据,没有的话重新获取
if(userInfo){
console.log('有store.getters.currentUserInfo',store.getters.currentUserInfo)
if(store.getters.permission_routes && store.getters.permission_routes.length > 0){
console.log('有store.getters.permission_routes',store.getters.permission_routes)
next()
}
else{
console.log('没有store.getters.permission_routes',store.getters.permission_routes)
const accessRoutes = await store.dispatch('permission/getApiColumnsNames')
router.addRoutes(accessRoutes)
next({
...to,
query:{
loginName:to.query.loginName,
isAutoLogin:to.query.isAutoLogin,
isSinglePage:to.query.isSinglePage
},
replace: true
})
}
}else{
// console.log('没有store.getters.currentUserInfo',store.getters.currentUserInfo)
if(!columZHList){
console.log('没有columZHList',columZHList)
await store.dispatch('definition/getColumZHList')
// const accessRoutes = await store.dispatch('permission/getApiColumnsNames')
// router.addRoutes(accessRoutes)
next({
...to,
query:{
loginName:to.query.loginName,
isAutoLogin:to.query.isAutoLogin,
isSinglePage:to.query.isSinglePage
},
replace: true
})
}
if(isAutoLogin || to.query.loginName){
console.log('有自动登录',isAutoLogin,to.query.loginName)
// 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(()=>{
let _username = to.query.loginName || localStorage.getItem("isLoginName") || localStorage.getItem("userNameOrEmailAddress")
if(to.path != '/login'){
await store.dispatch('user/getUserInfo',_username).then(()=>{
next({
...to,
query:{
loginName:to.query.loginName,
isAutoLogin:to.query.isAutoLogin,
isSinglePage:to.query.isSinglePage
},
replace: true
})
}).catch(()=>{
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`)
Message.error('获取用户信息失败,请重试!')
})
}else{
next()
// next({
// ...to,
// query:{
// loginName:to.query.loginName,
// isAutoLogin:to.query.isAutoLogin,
// isSinglePage:to.query.isSinglePage
// },
// replace: true
// })
}
// })
// .catch((error) => {
// console.log('登录失败')
// })
}
else{
console.log('不自动登录',isAutoLogin,to.query.loginName)
if (to.path != '/login') {
Message.error('获取用户信息失败,请重新登录')
next({
path:'/login',
query:{
isAutoLogin:to.query.isAutoLogin,
loginName:to.query.loginName,
isSinglePage:to.query.isSinglePage
},
replace: true
})
// next(`/login?loginName=${to.query.loginName}&isAutoLogin=${to.query.isAutoLogin}`)
// next(`/login`)
}else{
// next({
// ...to,
// query:{
// isAutoLogin:to.query.isAutoLogin,
// loginName:to.query.loginName,
// },
// replace: true
// })
next()
}
}
NProgress.done()
}
})
router.afterEach(() => {
// element-ui 使用 Tooltip 提示时候,更换页面,提示依旧存在偶现bug处理。
const mytooltipList = document.querySelectorAll('.el-tooltip__popper') // 获取页面所有tooltip的dom集合
setTimeout(() => {
mytooltipList.forEach((value) => {
value.style.display = 'none'
if(value.parentElement){
value.parentElement.removeChild(value)
}
})
}, 1000)
// finish progress bar
NProgress.done()
})

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

@ -6,7 +6,6 @@ import 'nprogress/nprogress.css' // progress bar style
import { getToken } from '@/utils/auth' // get token from cookie
import getPageTitle from '@/utils/get-page-title'
import { asyncRoutes } from '@/router'
import { login,getUsersByUserName } from "@/api/wms-auth"
NProgress.configure({
showSpinner: false

228
PC/InterFace.Dash/src/router/index-0718.js

@ -1,228 +0,0 @@
import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
/* Layout */
import Layout from '@/layout'
/* Router Modules */
// import basicDataRouter from './modules/basicData'
// import personRouter from './modules/person'
// import inventoryManageRouter from "./modules/inventoryManage"
// import systemManageRouter from "./modules/systemManage"
// import activeReportManageRouter from "./modules/activeReport"
// import manageRouter from "./modules/manageRouter"
// import rawMaterialManage from "./modules/rawMaterialManage"
// import finishedProductManage from "./modules/finishedProductManage"
// import labelManageRouter from "./modules/labelManageRouter"
// import storageManageRouter from "./modules/StorageManage"
// import productionManageRouter from "./modules/productionManage"
// import allocationManageRouter from "./modules/allocationManage"
// import deliverGoodsRouter from "./modules/deliverGoods"
// import recordQueryRouter from "./modules/recordQuery"
// import qualityManageRouter from "./modules/qualityManage"
// import taskManageRouter from "./modules/taskManage"
/**
* Note: sub-menu only appear when route children.length >= 1
* Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
*
* hidden: true if set true, item will not show in the sidebar(default is false)
* alwaysShow: true if set true, will always show the root menu
* if not set alwaysShow, when item has more than one children route,
* it will becomes nested mode, otherwise not show the root menu
* redirect: noRedirect if set noRedirect will no redirect in the breadcrumb
* name:'router-name' the name is used by <keep-alive> (must set!!!)
* meta : {
roles: ['admin','editor'] control the page roles (you can set multiple roles)
title: 'title' the name show in sidebar and breadcrumb (recommend set)
icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
noCache: true if set true, the page will no be cached(default is false)
affix: true if set true, the tag will affix in the tags-view
breadcrumb: false if set false, the item will hidden in breadcrumb(default is true)
activeMenu: '/example/list' if set path, the sidebar will highlight the path you set
}
*/
/**
* constantRoutes
* a base page that does not have permission requirements
* all roles can be accessed
*/
export const constantRoutes = [
{
path: '/redirect',
component: Layout,
hidden: true,
children: [{
path: '/redirect/:path(.*)',
component: () => import('@/views/redirect/index')
}]
},
// {
// path: '/testForm',
// component: () => import('@/views/testForm/index'),
// hidden: true
// },
{
path: '/login',
component: () => import('@/views/login/index'),
hidden: true
},
{
path: '/404',
component: () => import('@/views/error-page/404'),
hidden: true
},
{
path: '/401',
component: () => import('@/views/error-page/401'),
hidden: true
},
{
path: '/profileuser',
component: Layout,
redirect: '/profileuser/index',
hidden: true,
children: [{
path: 'index',
component: () => import('@/views/profileuser/index'),
name: 'Profileuser',
meta: {
title: '个人中心',
icon: 'user',
noCache: true
}
}]
},
{
path: '/',
component: Layout,
redirect: '/dashboard',
// hidden: true,
children: [{
path: 'dashboard',
component: () => import('@/views/dashboard/index'),
name: 'Dashboard',
meta: {
keepAlive : true,
title: '系统首页',
icon: '系统首页',
outerFirst:true
// affix: true
}
}]
},
// {
// path: '/',
// component: Layout,
// redirect: '/gridlayout',
// hidden: true,
// children: [{
// path: 'gridlayout',
// component: () => import('@/views/gridLayout/indexShow'),
// name: 'Gridlayout',
// meta: {
// keepAlive : true,
// title: '首页编辑器',
// icon: '系统首页',
// }
// }]
// },
// 开发中模拟路由
// {
// path: '/',
// component: Layout,
// redirect: '/TestSchool',
// hidden: true,
// children: [{
// path: 'TestSchool',
// component: () => import('@/views/interfaceBoard/TestSchool.vue'),
// name: 'TestSchool',
// meta: {
// title: 'TestSchool',
// icon: '拆分记录',
// }
// }]
// },
// {
// path: '/',
// component: Layout,
// redirect: '/_dashboard2',
// hidden: true,
// children: [{
// path: '_dashboard2',
// component: () => import('@/views/dashboard/_index2'),
// name: '_dashboard2',
// meta: {
// title: '_dashboard2',
// icon: '系统首页',
// }
// }]
// },
]
/**
* asyncRoutes
* the routes that need to be dynamically loaded based on user roles
*/
// 动态获取菜单信息
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
}
]
// export const asyncRoutes = [
// /** when your routing map is too long, you can split it into small modules **/
// // 404 page must be placed at the end !!!
// personRouter,
// basicDataRouter,
// rawMaterialManage,
// finishedProductManage,
// labelManageRouter,
// // storageManageRouter,
// inventoryManageRouter,
// // productionManageRouter,
// // qualityManageRouter,
// // taskManageRouter,
// // recordQueryRouter,
// manageRouter,
// activeReportManageRouter,
// systemManageRouter,
// // allocationManageRouter,
// // deliverGoodsRouter,
// {
// path: '*',
// redirect: '/404',
// hidden: true
// }
// ]
const createRouter = () => new Router({
// mode: 'history', // require service support
scrollBehavior: () => ({
y: 0
}),
routes: constantRoutes
})
const router = createRouter()
// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
const newRouter = createRouter()
router.matcher = newRouter.matcher // reset router
}
export default router

17
PC/InterFace.Dash/src/router/index.js

@ -8,7 +8,6 @@ Vue.use(Router)
import Layout from '@/layout'
/* Router Modules */
// import systemManage from './modules/systemManage'
/**
* Note: sub-menu only appear when route children.length >= 1
@ -61,22 +60,6 @@ export let constantRoutes = [
component: () => import('@/views/error-page/401'),
hidden: true
},
{
path: '/profileuser',
component: Layout,
redirect: '/profileuser/index',
hidden: true,
children: [{
path: 'index',
component: () => import('@/views/profileuser/index'),
name: 'Profileuser',
meta: {
title: '个人中心',
icon: 'user',
noCache: true
}
}]
},
{
path: '/',
component: Layout,

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

@ -6,14 +6,12 @@ const getters = {
visitedViews: state => state.tagsView.visitedViews,
cachedViews: state => state.tagsView.cachedViews,
token: state => state.user.token,
avatar: state => state.user.avatar,
introduction: state => state.user.introduction,
roles: state => state.user.roles,
currentUserInfo: state => state.user.userInfo,//当前用户信息
permission_routes: state => state.permission.routes,//接口获取的菜单
tablesName:state => state.permission.tablesName,//接口获取所有的表名
errorLogs: state => state.errorLog.logs,
dictionaries: state => state.dictionaries.dict,
enumList: state => state.definition.enumList,//接口获取的枚举
columZHList: state => state.definition.columZHList,//接口转义的表头
dtoColumnTypes: state => state.definition.dtoColumnTypes,//所有页面的dto类型

2
PC/InterFace.Dash/src/store/modules/definition.js

@ -1,4 +1,4 @@
import { getInterfaceBoard,getApiDefinition } from "@/api/wms-interface"
import { getInterfaceBoard,getApiDefinition } from "@/api/wms-auth"
const state = {
enumList: [],//枚举

33
PC/InterFace.Dash/src/store/modules/dictionaries.js

@ -1,33 +0,0 @@
import { dictFormatData } from "@/utils/index"
const state = {
dict: {}
}
const mutations = {
ADD_DICT: (state, dict) => {
Object.assign(state.dict,dict)
},
CLEAR_DICT: (state) => {
state.dict = {}
}
}
const actions = {
// addDict({ commit }, dict) {
// dictFormatData().then(res => {
// res.forEach(item => {
// commit('ADD_DICT', item)
// })
// })
// },
clearDict({ commit }) {
commit('CLEAR_DICT')
}
}
export default {
namespaced: true,
state,
mutations,
actions
}

163
PC/InterFace.Dash/src/store/modules/permission-0718.js

@ -1,163 +0,0 @@
import {
asyncRoutes,
constantRoutes
} from '@/router'
import Layout from '@/layout'
import { getWebMenu } from '@/api/wms-auth'
/**
* 静态路由懒加载
* @param view 格式必须为 xxx/xxx 开头不要加斜杠
* @returns
*/
export const loadView = (view) => {
return (resolve) => require([`@/views/${view}`], resolve)
}
/**
* 把从后端查询的菜单数据拼装成路由格式的数据
* @param routes
* @param data 后端返回的菜单数据
*/
export function generaMenu(routes, data) {
data.forEach(item => {
const menu = {
path: item.code,
component: item.component === '@/layout' ? Layout : loadView(item.component),
// hidden: item.status === 0, // 状态为0的隐藏
children: [],
name: item.code,
// meta: item.meta
meta: {
title: item.name,
icon: item.icon || '',
roles: item.permission
},
}
// 一级菜单 二级菜单 特定属性
if (item.component == '@/layout' || item.component == 'index') {
menu.alwaysShow = true
menu.redirect = 'noRedirect'
}
if (item.sort < 99) {
menu.level = 1
} else if (item.sort > 99 && item.sort < 9999) {
menu.level = 2
} else {
menu.level = 3
}
// iframe页面处理
// if (item.permission.indexOf('Report') > -1) {
// // delete menu.component
// menu.iframeComponent = item.component === '@/layout' ? Layout : loadView(item.component)
// menu.hasOpen = false // 是否打开过,默认false
// }
if (item.children && item.children.length > 0) {
generaMenu(menu.children, item.children)
}
// if (item.permission == 'skip' && item.children.length == 0) {
// }
routes.push(menu)
})
return routes
}
/**
* 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 state = {
routes: [],
addRoutes: []
}
const mutations = {
SET_ROUTES: (state, routes) => {
state.addRoutes = routes
state.routes = constantRoutes.concat(routes)
}
}
// todo-new:有token后使用generateRoutes,去掉下方一行代码
// state.routes = constantRoutes.concat(asyncRoutes)
const actions = {
generateRoutes({
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)
// todo-new:动态路由(等token接口恢复后处理)
getWebMenu({userId: userId}).then(res => {
let accessedRoutes = generaMenu(asyncRoutes, res)
let indexVal = 0
let childrenIndex = 0
filterAccessedRoutes(accessedRoutes,indexVal,childrenIndex)
commit('SET_ROUTES', accessedRoutes)
resolve(accessedRoutes)
}).catch(err => {
console.log(err)
})
})
}
}
export default {
namespaced: true,
state,
mutations,
actions
}

31
PC/InterFace.Dash/src/store/modules/permission.js

@ -3,8 +3,7 @@ import {
constantRoutes
} from '@/router'
import Layout from '@/layout'
import { getWebMenu } from '@/api/wms-auth'
import { getDefinitionMenu } from '@/api/wms-interface'
import { getDefinitionMenu } from '@/api/wms-auth'
import store from '@/store'
/**
@ -61,7 +60,7 @@ export function filterAsyncRoutes(routes, roles) {
}
const state = {
routes: [],
routes: [],//菜单
addRoutes: [],
tablesName:null,//所有的表名
}
@ -75,8 +74,6 @@ const mutations = {
state.tablesName = data
}
}
// todo-new:有token后使用generateRoutes,去掉下方一行代码
// state.routes = constantRoutes.concat(asyncRoutes)
/**
* 静态路由懒加载
* @param view 格式必须为 xxx/xxx 开头不要加斜杠
@ -261,30 +258,6 @@ const actions = {
})
})
},
// generateRoutes({
// 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)
// // todo-new:动态路由(等token接口恢复后处理)
// getWebMenu({userId: userId}).then(res => {
// let accessedRoutes = generaMenu(asyncRoutes, res)
// let indexVal = 0
// let childrenIndex = 0
// filterAccessedRoutes(accessedRoutes,indexVal,childrenIndex)
// commit('SET_ROUTES', accessedRoutes)
// resolve(accessedRoutes)
// }).catch(err => {
// console.log(err)
// })
// })
// }
}
export default {

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

@ -1,15 +1,12 @@
import {
token,
logout,
getInfo,
getUsersByUserName
} from '@/api/wms-auth'
import {
getToken,
setToken,
removeToken,
removeCompany,
removeWarehouseCode
} from '@/utils/auth'
import router, {
resetRouter
@ -18,13 +15,10 @@ import qs from 'qs'
const state = {
token: getToken(),
name: '',
avatar: '',
introduction: '',
roles: [],
userInfo:null
}
import { Message } from 'element-ui'
const mutations = {
SET_TOKEN: (state, token) => {
@ -33,12 +27,7 @@ const mutations = {
SET_INTRODUCTION: (state, introduction) => {
state.introduction = introduction
},
SET_NAME: (state, name) => {
state.name = name
},
SET_AVATAR: (state, avatar) => {
state.avatar = avatar
},
// 设置权限(v-permissin)
SET_ROLES: (state, roles) => {
state.roles = roles
},
@ -48,7 +37,6 @@ const mutations = {
}
const actions = {
// user login
login({
commit
@ -95,51 +83,6 @@ const actions = {
// })
})
},
// get user info
getInfo({
commit,dispatch
}) {
return new Promise((resolve, reject) => {
getInfo().then(response => {
const {
auth, currentUser
} = response
let data = {
roles: []
}
// if (!auth) {
// reject('Verification failed, please Login again.')
// }
// roles must be a non-empty array
// if (!roles || roles.length <= 0) {
// reject('getInfo: roles must be a non-null array!')
// }
for (var role in auth.grantedPolicies) {
if (auth.grantedPolicies[role] == true) {
data.roles.push(role)
}
}
if (!data.roles || data.roles.length <= 0) {
reject('该用户没有任何权限!')
}
commit('SET_ROLES', data.roles)
//获取当前登录用户信息
commit('SET_NAME', currentUser)
// commit('SET_NAME', name)
// commit('SET_AVATAR', avatar)
// commit('SET_INTRODUCTION', introduction)
dispatch('permission/generateRoutes', currentUser.id, { root: true }).then((accessRoutes) => {
router.addRoutes(accessRoutes)
})
// 当前用户登录获取字典信息 todo:new
// dispatch('dictionaries/addDict', null, { root: true })
resolve(currentUser.id)
}).catch(error => {
reject(error)
})
})
},
// user logout
logout({
@ -149,12 +92,9 @@ const actions = {
return new Promise((resolve, reject) => {
// logout().then(() => {
commit('SET_TOKEN', '')
commit('SET_ROLES', [])
// commit('SET_USERINFO', null)
// removeToken()
// resetRouter()
// removeCompany()
// removeWarehouseCode()
// reset visited views and cached views
// to fixed https://github.com/PanJiaChen/vue-element-admin/issues/2485
dispatch('tagsView/delAllViews', null, {
@ -177,39 +117,11 @@ const actions = {
commit('SET_TOKEN', '')
commit('SET_ROLES', [])
removeToken()
removeCompany()
removeWarehouseCode()
resolve()
})
},
// dynamically modify permissions
async changeRoles({
commit,
dispatch
}, role) {
const token = role + '-token'
commit('SET_TOKEN', token)
setToken(token)
const {
roles
} = await dispatch('getInfo')
resetRouter()
// generate accessible routes map based on roles
const accessRoutes = await dispatch('permission/generateRoutes', roles, {
root: true
})
// dynamically add accessible routes
router.addRoutes(accessRoutes)
// reset visited views and cached views
dispatch('tagsView/delAllViews', null, {
root: true
})
},
// get userInfo
getUserInfo({
commit
},username) {

24
PC/InterFace.Dash/src/utils/auth.js

@ -1,8 +1,6 @@
import Cookies from 'js-cookie'
const TokenKey = 'Admin-Token'
const CompanyKey = 'Admin-Company'
const WarehouseCodeKey = 'Admin-WarehouseCode'
export function getToken() {
return Cookies.get(TokenKey)
@ -15,25 +13,3 @@ export function setToken(token) {
export function removeToken() {
return Cookies.remove(TokenKey)
}
export function getCompany() {
return Cookies.get(CompanyKey)
}
export function setCompany(token) {
return Cookies.set(CompanyKey, token)
}
export function removeCompany() {
return Cookies.remove(CompanyKey)
}
export function getWarehouseCode() {
return Cookies.get(WarehouseCodeKey)
}
export function setWarehouseCode(token) {
return Cookies.set(WarehouseCodeKey, token)
}
export function removeWarehouseCode() {
return Cookies.remove(WarehouseCodeKey)
}

107
PC/InterFace.Dash/src/utils/formatTime.js

@ -82,4 +82,111 @@ export function formatTimeStampToNorm(data,type,connect){
default:
return year+arr[0] + month+arr[1] + day+arr[2] + " " +hour+arr[3] + minute+arr[4] + second+arr[5];
}
}
/**
* Parse the time to string
* @param {(Object|string|number)} time
* @param {string} cFormat
* @returns {string | null}
*/
export function parseTime(time, cFormat) {
if (arguments.length === 0 || !time) {
return null
}
const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
let date
if (typeof time === 'object') {
date = time
} else {
if ((typeof time === 'string')) {
if ((/^[0-9]+$/.test(time))) {
// support "1548221490638"
time = parseInt(time)
} else {
// support safari
// https://stackoverflow.com/questions/4310953/invalid-date-in-safari
time = time.replace(new RegExp(/-/gm), '/')
}
}
if ((typeof time === 'number') && (time.toString().length === 10)) {
time = time * 1000
}
date = new Date(time)
}
const formatObj = {
y: date.getFullYear(),
m: date.getMonth() + 1,
d: date.getDate(),
h: date.getHours(),
i: date.getMinutes(),
s: date.getSeconds(),
a: date.getDay()
}
const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
const value = formatObj[key]
// Note: getDay() returns 0 on Sunday
if (key === 'a') {
return ['日', '一', '二', '三', '四', '五', '六'][value]
}
return value.toString().padStart(2, '0')
})
return time_str
}
/**
* @param {number} time
* @param {string} option
* @returns {string}
*/
export function formatTime(time, option) {
if (('' + time).length === 10) {
time = parseInt(time) * 1000
} else {
time = +time
}
const d = new Date(time)
const now = Date.now()
const diff = (now - d) / 1000
if (diff < 30) {
return '刚刚'
} else if (diff < 3600) {
// less 1 hour
return Math.ceil(diff / 60) + '分钟前'
} else if (diff < 3600 * 24) {
return Math.ceil(diff / 3600) + '小时前'
} else if (diff < 3600 * 24 * 2) {
return '1天前'
}
if (option) {
return parseTime(time, option)
} else {
return (
d.getMonth() +
1 +
'月' +
d.getDate() +
'日' +
d.getHours() +
'时' +
d.getMinutes() +
'分'
)
}
}
/**
* @param {string} type
* @returns {Date}
*/
export function getTime(type) {
if (type === 'start') {
return new Date().getTime() - 3600 * 1000 * 24 * 90
} else {
return new Date(new Date().toDateString())
}
}

151
PC/InterFace.Dash/src/utils/index.js

@ -1,127 +1,8 @@
/**
* Created by PanJiaChen on 16/11/18.
*/
import {fileStorage, getPageList, getDictByCode} from '@/api/wms-api'
import {fileStorage, getPageList } from '@/api/wms-api'
import store from '@/store'
/**
* Parse the time to string
* @param {(Object|string|number)} time
* @param {string} cFormat
* @returns {string | null}
*/
export function parseTime(time, cFormat) {
if (arguments.length === 0 || !time) {
return null
}
const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
let date
if (typeof time === 'object') {
date = time
} else {
if ((typeof time === 'string')) {
if ((/^[0-9]+$/.test(time))) {
// support "1548221490638"
time = parseInt(time)
} else {
// support safari
// https://stackoverflow.com/questions/4310953/invalid-date-in-safari
time = time.replace(new RegExp(/-/gm), '/')
}
}
if ((typeof time === 'number') && (time.toString().length === 10)) {
time = time * 1000
}
date = new Date(time)
}
const formatObj = {
y: date.getFullYear(),
m: date.getMonth() + 1,
d: date.getDate(),
h: date.getHours(),
i: date.getMinutes(),
s: date.getSeconds(),
a: date.getDay()
}
const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
const value = formatObj[key]
// Note: getDay() returns 0 on Sunday
if (key === 'a') {
return ['日', '一', '二', '三', '四', '五', '六'][value]
}
return value.toString().padStart(2, '0')
})
return time_str
}
// export function timeWeek() {
// let data = new Date().getDay()
// switch (data) {
// case 0:
// console.log("日");
// break;
// case 1:
// console.log("一");
// break;
// case 2:
// console.log("二");
// break;
// case 3:
// console.log("三");
// break;
// case 4:
// console.log("四");
// break;
// case 5:
// console.log("五");
// break;
// case 6:
// console.log("六");
// break;
// }
// }
/**
* @param {number} time
* @param {string} option
* @returns {string}
*/
export function formatTime(time, option) {
if (('' + time).length === 10) {
time = parseInt(time) * 1000
} else {
time = +time
}
const d = new Date(time)
const now = Date.now()
const diff = (now - d) / 1000
if (diff < 30) {
return '刚刚'
} else if (diff < 3600) {
// less 1 hour
return Math.ceil(diff / 60) + '分钟前'
} else if (diff < 3600 * 24) {
return Math.ceil(diff / 3600) + '小时前'
} else if (diff < 3600 * 24 * 2) {
return '1天前'
}
if (option) {
return parseTime(time, option)
} else {
return (
d.getMonth() +
1 +
'月' +
d.getDate() +
'日' +
d.getHours() +
'时' +
d.getMinutes() +
'分'
)
}
}
/**
* @param {string} url
@ -142,6 +23,7 @@ export function getQueryObject(url) {
return obj
}
// 返回utf8字符串的字节长度
/**
* @param {string} input value
* @returns {number} output value
@ -262,18 +144,6 @@ export function objectMerge(target, source) {
// element.className = classString
// }
/**
* @param {string} type
* @returns {Date}
*/
export function getTime(type) {
if (type === 'start') {
return new Date().getTime() - 3600 * 1000 * 24 * 90
} else {
return new Date(new Date().toDateString())
}
}
/**
* @param {Function} func
* @param {number} wait
@ -530,23 +400,6 @@ export function dictFormatData() {
})
})
}
// export function dictFormatData(code) {
// return new Promise(resolve => {
// let rs = {}
// getDictByCode(code).then(res => {
// res.items.forEach((item,index) => {
// rs[item.code] = {
// label: item.name,
// value: Number(item.code)
// }
// })
// resolve(rs)
// }).catch(err => {
// console.log(err)
// reject(err)
// })
// })
// }
// 像接口传参时候需要补充.0000000 否则会报错情况下转义
export function initDataToHttpFormat (date) {

209
PC/InterFace.Dash/src/utils/processButtonData.js

@ -1,209 +0,0 @@
// 申请流程按钮name值统一封装
const requestDataNames = {
submit:'submitRequest',//提交
agree:'agreeRequest',//审批
handle:'handleRequest',//处理
againHandle:"againHandleRequest",//执行
abort:'abortRequest',//中止
refuse:'refuseRequest',//驳回
cancel:'cancelRequest',//取消
}
export default requestDataNames;
//申请流程按钮
/**
* @param {*} that 主页this
* @param {*} label 特殊label名称更改 示例{againHandleRequest:'确认提交'}
* @param {*} initHide 自定义返回是否隐藏函数 {againHandleRequest:() => {return false)}
* @param {*} noShow 不显示的按钮 示例['againHandleRequest']
* initHide优先级大于noShow 如果initHide和noShow中都有对应数据则noShow无效
* vue调用文件参考示例
* 1使用 label 更改按钮名称
DrawerButtonData: [
...requestData(this,{againHandleRequest:'新按钮名称'}),
]
* 2使用 initHide 函数处理是否隐藏 againHandleRequestInit为业务线判断隐藏函数返回值为false/true
DrawerButtonData: [
...requestData(this,false,{
againHandleRequest:() => {return this.againHandleRequestInit([9])}
}),
]
* 3使用 noShow 隐藏按钮
DrawerButtonData: [
...requestData(this,false,false,['againHandleRequest']),
]
* @returns
*/
export function requestData(that,label,initHide,noShow){
return [
{
type: 'primary',
icon: 'el-icon-circle-check',
// label: label==undefined?'提交':label,
label: changeLabelText(label,requestDataNames.submit)?changeLabelText(label,requestDataNames.submit):'提交',
name: requestDataNames.submit,
hide: () => { return hideButtonRequest(that, [1], initHide, noShow , requestDataNames.submit) },
size: 'mini'
},
{
type: 'primary',
icon: 'el-icon-circle-check',
// label: label==undefined?'审批':label,
label: changeLabelText(label,requestDataNames.agree)?changeLabelText(label,requestDataNames.agree):'审批',
name: requestDataNames.agree,
hide: () => { return hideButtonRequest(that, [2], initHide, noShow , requestDataNames.agree) },
size: 'mini'
},
{
type: 'primary',
icon: 'el-icon-circle-check',
// label: label==undefined?'处理':label,
label: changeLabelText(label,requestDataNames.handle)?changeLabelText(label,requestDataNames.handle):'处理',
name: requestDataNames.handle,
hide: () => { return hideButtonRequest(that, [4], initHide, noShow , requestDataNames.handle) },
size: 'mini'
},
{
type: 'primary',
icon: 'el-icon-circle-check',
// label: '执行',
label: changeLabelText(label,requestDataNames.againHandle)?changeLabelText(label,requestDataNames.againHandle):'执行',
name: requestDataNames.againHandle,
hide: () => { return hideButtonRequest(that, [9], initHide, noShow , requestDataNames.againHandle) },
size: 'mini'
},
{
type: 'danger',
icon: 'el-icon-delete-solid',
// label: '中止',
label: changeLabelText(label,requestDataNames.abort)?changeLabelText(label,requestDataNames.abort):'中止',
name: requestDataNames.abort,
hide: () => { return hideButtonRequest(that, [5], initHide, noShow , requestDataNames.abort) },
size: 'mini'
},
{
type: 'danger',
icon: 'el-icon-circle-check',
// label: '驳回',
label: changeLabelText(label,requestDataNames.refuse)?changeLabelText(label,requestDataNames.refuse):'驳回',
name: requestDataNames.refuse,
hide: () => { return hideButtonRequest(that, [2], initHide, noShow , requestDataNames.refuse) },
size: 'mini'
},
{
type: 'danger',
icon: 'el-icon-delete-solid',
// label: '取消',
label: changeLabelText(label,requestDataNames.cancel)?changeLabelText(label,requestDataNames.cancel):'取消',
name: requestDataNames.cancel,
hide: () => { return hideButtonRequest(that, [1,2,4], initHide, noShow , requestDataNames.cancel) },
size: 'mini'
},
// {
// type: 'primary',
// icon: 'el-icon-circle-check',
// label: '执行完成',
// name: "completeRequest",
// hide: () => { return hideButtonRequest(that, [5]) },
// size: 'mini'
// },
]
}
//任务流程按钮
/**
* @param {*} that 主页this
* @returns
*/
export function jobData(that){
return [
{
type: 'primary',
icon: 'el-icon-circle-check',
label: '接受',
name: "acceptJob",
hide: () => { return hideButtonJob(that, [1]) },
size: 'mini'
},
{
type: 'primary',
icon: 'el-icon-circle-check',
label: '执行',
name: "handleJob",
hide: () => { return hideButtonJob(that, [2]) },
size: 'mini'
},
{
type: 'primary',
icon: 'el-icon-circle-check',
label: '打开',
name: "openJob",
hide: () => { return hideButtonJob(that, [4]) },
size: 'mini'
},
{
type: 'danger',
icon: 'el-icon-circle-close',
label: '关闭',
name: "closeJob",
hide: () => { return hideButtonJob(that, [1]) },
size: 'mini'
},
{
type: 'danger',
icon: 'el-icon-delete-solid',
label: '作废',
name: "invalidJob",
hide: () => { return hideButtonJob(that, [1, 4]) },
size: 'mini'
},
{
type: 'danger',
icon: 'el-icon-circle-close',
label: '取消',
name: "cancelAcceptJob",
hide: () => { return hideButtonJob(that, [2]) },
size: 'mini'
},
]
}
function hideButtonRequest(that, val, initHide, noShow, name) {
let data = true
// 走自定义是否隐藏事件
if(initHide && initHide[name]){
data = initHide[name]()
}else{
// 隐藏按钮中是否有此按钮
if(noShow && noShow.indexOf(name) >= 0){
data = true
}else{
val.forEach(key => {
if (that.propsData.requestStatus == key) {
data = false
}
})
}
}
return data
}
function hideButtonJob(that, val) {
let data = true
val.forEach(key => {
if (that.propsData.jobStatus == key) {
data = false
}
})
return data
}
// 更改按钮自定义特殊名称
function changeLabelText(labels,name){
if(labels && labels[name]){
return labels[name]
}
return false
}

4
PC/InterFace.Dash/src/utils/tableColumns/index.js

@ -1,9 +1,5 @@
// 通用配置
const orderWidth = 180
import zh from '@/lang/zh'
let _Public = zh.ColumsPublic // 字段通用
let _Names = zh.ColumsNames // 业务字段
// 字段说明
// showProp: true //隐藏该字段的高级筛选+列表排序

3
PC/InterFace.Dash/src/utils/tabsDesTions/index.js

@ -1,3 +0,0 @@
import zh from '@/lang/zh'
let _Public = zh.ColumsPublic // 字段通用
let _Names = zh.ColumsNames // 接口监控看板

246
PC/InterFace.Dash/src/views/gridLayout/components/baseConfig/countDown.vue

@ -1,246 +0,0 @@
<template>
<div class="countDownOuterPage" :class="[countDownConfig.boxShadow?'shadow':'']">
<!-- 标题 -->
<div
class="countDown-title"
:style="countDownConfig.titleStyle"
>{{countDownConfig.title}}</div>
<!-- 时间 -->
<el-statistic
v-if="countDownConfig.format && countDownConfig.format.length > 0"
:format="countDownConfig.format"
:value="countDownConfig.value"
:value-style="countDownConfig.valueStyle"
time-indices
></el-statistic>
<!-- 默认毫秒的 -->
<el-statistic
v-else
:value="countDownConfig.value"
:value-style="countDownConfig.valueStyle"
time-indices
></el-statistic>
<!-- 编辑按钮 -->
<el-button
v-if="!isHome"
class="gridItem-edit-button"
type="warning"
circle
icon="el-icon-edit"
@click="moreHandle"
size="mini"
></el-button>
<!-- 更多配置弹窗 -->
<el-dialog
:visible.sync="showMoreEdit"
width="40%"
:append-to-body="true"
:show-close="true"
:close-on-click-modal="true"
:close-on-press-escape="true"
title="更多配置"
>
<el-form
class="countDownForm"
:model="countDownForm"
label-position="right"
label-width="150px"
>
<!-- 基础设置 -->
<div class="gridLayout-editTitle-line">基础设置</div>
<el-form-item label="显示底部阴影">
<el-radio-group v-model="countDownForm.boxShadow">
<el-radio border :label="true">显示</el-radio>
<el-radio border :label="false">不显示</el-radio>
</el-radio-group>
</el-form-item>
<!-- 标题设置 -->
<div class="gridLayout-editTitle-line">标题设置</div>
<!-- 标题内容 -->
<el-form-item label="标题内容">
<el-input v-model="countDownForm.title"></el-input>
</el-form-item>
<!-- 标题字号 -->
<el-form-item label="标题字号">
<el-input v-model="countDownForm.titleStyle.fontSize"></el-input>
</el-form-item>
<!-- 标题颜色 -->
<el-form-item label="标题颜色">
<el-color-picker
v-model="countDownForm.titleStyle.color"
show-alpha
:predefine="predefineColors"
></el-color-picker>
</el-form-item>
<!-- 标题行高 -->
<el-form-item label="标题行高">
<el-input v-model="countDownForm.titleStyle.lineHeight"></el-input>
</el-form-item>
<!-- 标题粗体 -->
<el-form-item label="标题是否粗体">
<el-radio-group v-model="countDownForm.titleStyle.fontWeight">
<el-radio border label="normal">正常</el-radio>
<el-radio border label="bold">粗体</el-radio>
</el-radio-group>
</el-form-item>
<!-- 时间设置 -->
<div class="gridLayout-editTitle-line">时间设置</div>
<!-- 到期时间 -->
<el-form-item label="到期时间">
<el-date-picker
v-model="countDownForm.value"
type="datetime"
placeholder="到期日期时间">
</el-date-picker>
</el-form-item>
<!-- 时间格式 -->
<el-form-item label="时间格式">
<!-- <el-input v-model="countDownForm.format"></el-input> -->
<el-select v-model="countDownForm.format" placeholder="请选择时间格式">
<el-option
v-for="item in formatOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<!-- 时间字号 -->
<el-form-item :label="'时间字号'">
<el-input v-model="countDownForm.valueStyle.fontSize"></el-input>
</el-form-item>
<!--时间颜色 -->
<el-form-item :label="'时间颜色'">
<el-color-picker
v-model="countDownForm.valueStyle.color"
show-alpha
:predefine="predefineColors"
></el-color-picker>
</el-form-item>
<!-- 时间粗体 -->
<el-form-item :label="'时间是否粗体'">
<el-radio-group v-model="countDownForm.valueStyle.fontWeight">
<el-radio border label="normal">正常</el-radio>
<el-radio border label="bold">粗体</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="settingCancleHandle">取消</el-button>
<el-button type="primary" @click="settingSureHandle">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getPredefineColors } from "../gridLayout"
export default {
name: "countDown",
props:{
gridItem: {
type: Object,
default: () => {
return {}
}
},
//
isHome: {
type: Boolean,
default: () => {
return false
}
}
},
data(){
return{
showMoreEdit:false,
//
countDownConfig:{},
//form countDownConfig
countDownForm:{
value: null,
valueStyle:{
fontSize:'20px',
color:'#303133',
fontWeight:'normal',
},
title:"倒计时",
titleStyle:{
fontSize:'14px',
color:'#666',
lineHeight:'24px',
fontWeight:'bold',
},
format:'HH:mm:ss',
boxShadow:true
},
formatOptions:[{
value: false,
label: '精确到毫秒'
},{
value: 'HH:mm:ss',
label: '精确到秒'
}, {
value: 'HH:mm',
label: '精确到分'
}, {
value: 'HH时',
label: '精确到时'
}],
predefineColors:getPredefineColors(),
}
},
created() {
if(this.gridItem.gridSettings){
this.countDownForm = JSON.parse(JSON.stringify(this.gridItem.gridSettings))
}
this.countDownConfig = JSON.parse(JSON.stringify(this.countDownForm))
},
methods:{
//
moreHandle(){
this.showMoreEdit = true
},
// []
settingSureHandle(){
this.countDownConfig = JSON.parse(JSON.stringify(this.countDownForm))
this.countDownConfig.value = new Date(this.countDownConfig.value).getTime()
this.showMoreEdit = false
},
// []
settingCancleHandle(){
this.countDownForm = JSON.parse(JSON.stringify(this.countDownConfig))
this.showMoreEdit = false
},
//
getSettings(){
return this.countDownConfig
}
}
}
</script>
<style lang="scss" scoped>
@import "../gridLayout.scss";
.countDownOuterPage{
width: 100%;
height: 100%;
background: #fff;
&.shadow{
box-shadow: 2px 2px 10px #ddd;
}
}
.countDown-title{
text-align: center;
padding: 10px 0 5px 0;
color: #666;
font-size: 14px;
font-weight: normal;
line-height: 24px;
}
</style>

222
PC/InterFace.Dash/src/views/gridLayout/components/baseConfig/gridText.vue

@ -1,222 +0,0 @@
<template>
<div class="gridTextOuter" :class="[gridTextConfig.boxShadow?'shadow':'']">
<div class="editShowContent">
<!-- 确定后的值及配置样式 -->
<div
class="finishText"
:style="{
'font-size':gridTextConfig.fontSize,
'color':gridTextConfig.fontColor,
'line-height':gridTextConfig.lineHeight,
'font-weight':gridTextConfig.fontWeight,
'text-align':gridTextConfig.centerValue,
}"
>{{gridTextConfig.text}}</div>
<!-- 编辑按钮 -->
<el-button
v-if="!isHome"
class="gridItem-edit-button"
type="warning"
circle
icon="el-icon-edit"
@click="moreHandle"
size="mini"
></el-button>
</div>
<!-- 更多配置弹窗 -->
<el-dialog
:visible.sync="showMoreEdit"
width="40%"
:append-to-body="true"
:show-close="true"
:close-on-click-modal="true"
:close-on-press-escape="true"
title="编辑配置"
>
<el-form
class="gridTextForm"
:model="gridTextForm"
label-position="right"
label-width="120px"
>
<!-- 文本内容 -->
<el-form-item label="文本内容">
<el-input v-model="gridTextForm.text" type="textarea" autosize></el-input>
</el-form-item>
<!-- 字号 -->
<el-form-item label="字号">
<el-input v-model="gridTextForm.fontSize"></el-input>
</el-form-item>
<!-- 行高 -->
<el-form-item label="行高">
<el-input v-model="gridTextForm.lineHeight"></el-input>
</el-form-item>
<!-- 字体颜色 -->
<el-form-item label="字体颜色">
<el-color-picker
v-model="gridTextForm.fontColor"
show-alpha
:predefine="predefineColors"
></el-color-picker>
</el-form-item>
<!-- 粗体 -->
<el-form-item label="是否粗体">
<el-radio-group v-model="gridTextForm.fontWeight">
<el-radio border label="normal">正常</el-radio>
<el-radio border label="bold">粗体</el-radio>
</el-radio-group>
</el-form-item>
<!-- 是否显示底部阴影 -->
<el-form-item label="显示">
<el-radio-group v-model="gridTextForm.boxShadow">
<el-radio border :label="true">显示</el-radio>
<el-radio border :label="false">不显示</el-radio>
</el-radio-group>
</el-form-item>
<!-- 对齐方式 -->
<el-form-item label="对齐方式">
<el-select v-model="gridTextForm.centerValue" placeholder="请选择对齐方式">
<el-option
v-for="item in centerOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="settingCancleHandle">取消</el-button>
<el-button type="primary" @click="settingSureHandle">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getPredefineColors } from "../gridLayout"
export default {
name: "gridText",
props:{
gridItem: {
type: Object,
default: () => {
return {}
}
},
//
isHome: {
type: Boolean,
default: () => {
return false
}
}
},
data(){
return{
gridTextConfig:{},//
//form gridTextConfig
gridTextForm:{},
showMoreEdit:false,//
//
centerOptions: [{
value: 'left',
label: '左对齐'
}, {
value: 'center',
label: '居中'
}, {
value: 'right',
label: '右对齐'
}],
predefineColors:getPredefineColors()
}
},
mounted() {
if(this.gridItem.gridSettings){
this.gridTextForm = JSON.parse(JSON.stringify(this.gridItem.gridSettings))
}else{
if(this.gridItem.name == 'gridTitle'){
this.gridTextForm = {
text:'标题内容',//
fontSize:"22px",//
fontColor:"#333",//
lineHeight:"34px",
fontWeight:'bold',//
boxShadow:false,//
centerValue:'center',//
}
}
if(this.gridItem.name == 'gridText'){
this.gridTextForm = {
text:'文本内容',//
fontSize:"14px",//
fontColor:"#666",//
lineHeight:"30px",
fontWeight:'normal',//
boxShadow:true,//
centerValue:'left',//
}
}
}
this.gridTextConfig = JSON.parse(JSON.stringify(this.gridTextForm))
},
methods:{
//
moreHandle(){
this.showMoreEdit = true
},
// []
settingSureHandle(){
this.gridTextConfig = JSON.parse(JSON.stringify(this.gridTextForm))
this.showMoreEdit = false
},
// []
settingCancleHandle(){
this.gridTextForm = JSON.parse(JSON.stringify(this.gridTextConfig))
this.showMoreEdit = false
},
//
getSettings(){
return this.gridTextForm
}
}
}
</script>
<style lang="scss" scoped>
@import "../gridLayout.scss";
.gridTextOuter{
display: flex;
align-items: center;
padding: 0 40px 0 25px;
width: 100%;
height: 100%;
background: #fff;
&.shadow{
box-shadow: 2px 2px 10px #ddd;
}
}
.editShowContent{
width: 100%;
display: flex;
align-items: center;
.finishText{
width: 100%;
padding: 0;
margin: 0;
line-height: 34px;
font-size: 14px;
color: #666;
}
.finishText{
padding-left: 15px;
}
}
.gridTextForm{
.el-input,.el-select{
width: 80%;
}
}
</style>

366
PC/InterFace.Dash/src/views/gridLayout/components/baseConfig/statistics.vue

@ -1,366 +0,0 @@
<template>
<div class="statisticOuterPage" :class="[statisticsConfig.boxShadow?'shadow':'']">
<!-- 标题 -->
<div
class="statistic-title"
:style="statisticsConfig.titleStyle"
>{{statisticsConfig.title}}</div>
<!-- 数值 el-statistic的precision配置不好用自己更改赋值-->
<div class="elStatisticBox-outer">
<div
class="elStatisticBox"
v-for="(number_op,index) in statisticsConfig.numberConfig"
:key="index"
>
<el-statistic
:decimal-separator="number_op.decimalSeparator"
:group-separator="number_op.groupSeparator"
:value="number_op.value"
:prefix="number_op.prefix"
:suffix="number_op.suffix"
:value-style="number_op.numberStyle"
>
<template slot="suffix">
<span
class="numberConfig-suffix"
v-if="index < statisticsConfig.numberConfig.length - 1"
>{{statisticsConfig.numberSuffix}}</span>
</template>
</el-statistic>
</div>
</div>
<!-- 编辑按钮 -->
<el-button
v-if="!isHome"
class="gridItem-edit-button"
type="warning"
circle
icon="el-icon-edit"
@click="moreHandle"
size="mini"
></el-button>
<!-- 更多配置弹窗 -->
<!-- v-if="showMoreEdit"
:visible="true"
width="40%"
append-to-body
show-close -->
<el-dialog
:visible.sync="showMoreEdit"
width="40%"
:append-to-body="true"
:show-close="true"
:close-on-click-modal="true"
:close-on-press-escape="true"
title="更多配置"
>
<el-form
class="statisticstForm"
:model="statisticsForm"
label-position="right"
label-width="150px"
>
<!-- 基础设置 -->
<el-collapse v-model="activeNames">
<el-collapse-item name="nav1">
<template slot="title">
<div class="gridLayout-editTitle-line">基础设置</div>
</template>
<el-form-item label="显示底部阴影">
<el-radio-group v-model="statisticsForm.boxShadow">
<el-radio border :label="true">显示</el-radio>
<el-radio border :label="false">不显示</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="多数值间连接符">
<el-input v-model="statisticsForm.numberSuffix"></el-input>
</el-form-item>
</el-collapse-item>
</el-collapse>
<!-- 标题设置 -->
<el-collapse v-model="activeNames">
<el-collapse-item name="nav2">
<template slot="title">
<div class="gridLayout-editTitle-line">标题设置</div>
</template>
<!-- 标题内容 -->
<el-form-item label="标题内容">
<el-input v-model="statisticsForm.title"></el-input>
</el-form-item>
<!-- 标题字号 -->
<el-form-item label="标题字号">
<el-input v-model="statisticsForm.titleStyle.fontSize"></el-input>
</el-form-item>
<!-- 标题颜色 -->
<el-form-item label="标题颜色">
<el-color-picker
v-model="statisticsForm.titleStyle.color"
show-alpha
:predefine="predefineColors"
></el-color-picker>
</el-form-item>
<!-- 标题行高 -->
<el-form-item label="标题行高">
<el-input v-model="statisticsForm.titleStyle.lineHeight"></el-input>
</el-form-item>
<!-- 标题粗体 -->
<el-form-item label="标题是否粗体">
<el-radio-group v-model="statisticsForm.titleStyle.fontWeight">
<el-radio border label="normal">正常</el-radio>
<el-radio border label="bold">粗体</el-radio>
</el-radio-group>
</el-form-item>
</el-collapse-item>
</el-collapse>
<!-- 数值 -->
<el-collapse v-model="activeNames">
<el-collapse-item
v-for="(number_op,index) in statisticsForm.numberConfig"
:key="index"
:name="'nav3-'+ Number(index + 1)"
>
<template slot="title">
<div class="gridLayout-editTitle-line">
数值{{Number(index+1)}}设置
<el-button
type="danger"
icon="el-icon-minus"
circle
@click="removeNumberRow(index,number_op)"
class="remove-numberRow-Btn"
size="mini"
></el-button>
</div>
</template>
<el-form-item :label="'数值'+Number(index+1)">
<el-input v-model="number_op.number"></el-input>
</el-form-item>
<!-- 数值字号 -->
<el-form-item :label="'数值'+Number(index+1)+'字号'">
<el-input v-model="number_op.numberStyle.fontSize"></el-input>
</el-form-item>
<!-- 数值颜色 -->
<el-form-item :label="'数值'+Number(index+1)+'颜色'">
<el-color-picker
v-model="number_op.numberStyle.color"
show-alpha
:predefine="predefineColors"
></el-color-picker>
</el-form-item>
<!-- 数值粗体 -->
<el-form-item :label="'数值'+Number(index+1)+'是否粗体'">
<el-radio-group v-model="number_op.numberStyle.fontWeight">
<el-radio border label="normal">正常</el-radio>
<el-radio border label="bold">粗体</el-radio>
</el-radio-group>
</el-form-item>
<!-- 千分位标识符 -->
<el-form-item :label="'数值'+Number(index+1)+'千分位标识符'">
<el-input v-model="number_op.groupSeparator"></el-input>
</el-form-item>
<!-- 小数点标识符 -->
<el-form-item :label="'数值'+Number(index+1)+'小数点标识符'">
<el-input v-model="number_op.decimalSeparator"></el-input>
</el-form-item>
<!-- 保留小数点位数 -->
<el-form-item :label="'数值'+Number(index+1)+'保留小数点位数'">
<el-input v-model="number_op.precision"></el-input>
</el-form-item>
<!-- 数值前缀字符 -->
<el-form-item :label="'数值'+Number(index+1)+'前缀字符'">
<el-input v-model="number_op.prefix"></el-input>
</el-form-item>
<!-- 数值后缀字符 -->
<el-form-item :label="'数值'+Number(index+1)+'后缀字符'">
<el-input v-model="number_op.suffix"></el-input>
</el-form-item>
</el-collapse-item>
</el-collapse>
<el-button
@click="addNumberRow"
style="width:100%"
type="primary"
>添加数值</el-button>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="settingCancleHandle">取消</el-button>
<el-button type="primary" @click="settingSureHandle">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getPredefineColors } from "../gridLayout"
export default {
name: "statistics",
props:{
gridItem: {
type: Object,
default: () => {
return {}
}
},
//
isHome: {
type: Boolean,
default: () => {
return false
}
}
},
data(){
return{
showMoreEdit:false,
//
activeNames:[],
//
defaultNumberOP:{
number:null,
value:null,
numberStyle:{
fontSize:'20px',
color:'#303133',
fontWeight:'normal',
},
groupSeparator:",",//
decimalSeparator:".",//
precision:2,//
prefix:'',//
suffix:'',//
},
//
defaultForm:{
numberConfig:[],
title:"数值",
titleStyle:{
fontSize:'14px',
color:'#666',
lineHeight:'24px',
fontWeight:'bold',
},
boxShadow:true,
numberSuffix:'—',//
},
//
statisticsConfig:{},
//form statisticsConfig
statisticsForm:{},
predefineColors:getPredefineColors()
}
},
created() {
if(this.gridItem.gridSettings){
this.statisticsForm = JSON.parse(JSON.stringify(this.gridItem.gridSettings))
}else{
this.defaultForm.numberConfig = []
this.defaultForm.numberConfig.push(JSON.parse(JSON.stringify(this.defaultNumberOP)))
this.statisticsForm = JSON.parse(JSON.stringify(this.defaultForm))
}
// todo:number
this.initNumberConfig()
},
methods:{
//
initNumberConfig(){
this.statisticsConfig = JSON.parse(JSON.stringify(this.statisticsForm))
// todo:.00
this.statisticsConfig.numberConfig.forEach(item => {
item.value = Number(
(Number(item.number)).toFixed(Number(item.precision))
)
});
},
//
initActiveNames(){
this.activeNames=['nav1','nav2']
this.statisticsForm.numberConfig.forEach((item,key)=>{
this.activeNames.push('nav3-'+ Number(key + 1))
})
},
//
moreHandle(){
this.initActiveNames()
this.showMoreEdit = true
},
// []
settingSureHandle(){
this.initNumberConfig()
this.showMoreEdit = false
},
// []
settingCancleHandle(){
this.statisticsForm = JSON.parse(JSON.stringify(this.statisticsConfig))
this.showMoreEdit = false
},
//
addNumberRow(){
this.statisticsForm.numberConfig.push(JSON.parse(JSON.stringify(this.defaultNumberOP)))
this.initActiveNames()
},
//
removeNumberRow(index,item){
if(this.statisticsForm.numberConfig.length <= 1){
this.$message.error("数据值至少保留一项")
return
}
this.statisticsForm.numberConfig.splice(index,1)
},
//
getSettings(){
return this.statisticsConfig
}
}
}
</script>
<style lang="scss" scoped>
@import "../gridLayout.scss";
.statisticOuterPage{
width: 100%;
height: 100%;
background: #fff;
&.shadow{
box-shadow: 2px 2px 10px #ddd;
}
}
.elStatisticBox-outer{
display: flex;
justify-content: center;
flex-wrap: wrap;
.numberConfig-suffix{
padding: 0 10px;
color: #999;
}
.elStatisticBox{
padding-bottom: 10px;
}
}
.el-collapse{
margin-bottom: 20px !important;
}
.statistic-title{
text-align: center;
padding: 10px 0 5px 0;
color: #666;
font-size: 14px;
font-weight: normal;
line-height: 24px;
}
.gridLayout-editTitle-line{
margin-top: 0;
border-top: none;
.remove-numberRow-Btn{
position: absolute;
right: 10px;
top: 20px;
}
&::before{
top: 26px;
}
}
</style>

186
PC/InterFace.Dash/src/views/gridLayout/components/chart/bar.vue

@ -1,186 +0,0 @@
<template>
<div :id="gridItem.name+'-chart'+gridItem.i" class="chartMainOuter">
<dialogIndex :dialogVisible="dialogVisible" @close="close"></dialogIndex>
</div>
</template>
<script>
import { getList } from "@/views/gridLayout/components/gridLayout"
import { createEachartAreaStyleColor } from "@/views/gridLayout/components/gridLayout"
import dialogIndex from "@/components/News/dialogIndex"
export default {
name: "mesBar",
data () {
return {
xAxisData: [],
seriesData: [],
dialogVisible: false,
title: '',
settings:{
lineColorArr:[],
areaStyles:[],
},
}
},
components: {
dialogIndex
},
props:{
gridItem: {
type: Object,
default: () => {
return {}
}
},
//
isHome: {
type: Boolean,
default: () => {
return false
}
},
//
dataSourceId: {
type: String,
default: () => {
return ''
}
}
},
mounted() {
getList(JSON.parse(localStorage.getItem(this.dataSourceId))).then( rs => {
this.title = rs.title,
this.xAxisData = rs.xAxisData,
this.seriesData = rs.seriesData
this.initSettings()
})
},
methods: {
//
initSettings(){
//
if(this.gridItem.gridSettings){
this.settings = JSON.parse(JSON.stringify(this.gridItem.gridSettings))
setTimeout(() => {
this.drawChart();
},200)
}else{
//
this.setEchartColor()
}
},
//
setEchartColor(){
let _finalSettings = createEachartAreaStyleColor(this.seriesData,0.8,0.5)
this.settings.lineColorArr = _finalSettings.lineColorArr
this.settings.areaStyles = []
this.seriesData.forEach((item,key) => {
this.settings.areaStyles.push({
color: new this.$echarts.graphic.LinearGradient(
0,1,0,0, _finalSettings.areaStyles[key].color
)
})
})
setTimeout(() => {
this.drawChart();
},200)
},
drawChart() {
// domecharts main
let myChart = this.$echarts.init(document.getElementById(this.gridItem.name+"-chart"+this.gridItem.i));
//
// seriesData
let series = []
let series_legend = []
this.seriesData.forEach((item,key) => {
series.push({
name: item.name,
type: "bar",
// barMaxWidth: 30,
// barWidth: 30,
itemStyle: this.settings.areaStyles[key],
data: item.data
})
series_legend.push(item.name)
})
let option = {
title: {
text: this.title==null?"柱状图":this.title,
left:'center',
top:'10',
triggerEvent: this.isHome
},
tooltip: {},
grid: {
left: "30",
right: "30",
bottom: "40",
top:"70",
containLabel: true,
},
legend: {
// icon: "roundRect",//     circlerect roundRecttrianglediamondpinarrownone
align:'left',//
right:'center',
bottom:'10',
data: series_legend,
},
xAxis: {
data: this.xAxisData,
axisLine: {
lineStyle: {
color: '#ddd',
}
},
axisLabel: {
show: true,
textStyle: {
color: '#666'
}
},
},
yAxis: {
type: "value",
axisLabel: {
show: true,
textStyle: {
color: '#666'
}
},
axisLine: {
lineStyle: {
color: '#fff',
}
},
axisTick:{
show:false
}
},
series: series
};
// 使
myChart.setOption(option);
window.addEventListener('resize',function(){
myChart.resize()
})
myChart.off('click');//
myChart.on('click', params => { //
if (params.componentType === 'title') { // title
this.dialogVisible = true
}
})
},
close() {
this.dialogVisible = false
},
//
getSettings(){
return this.settings
}
}
}
</script>
<style lang="scss" scoped>
@import "../gridLayout.scss";
</style>

194
PC/InterFace.Dash/src/views/gridLayout/components/chart/line.vue

@ -1,194 +0,0 @@
<template>
<div :id="gridItem.name+'-chart'+gridItem.i" class="chartMainOuter">
<dialogIndex :dialogVisible="dialogVisible" @close="close"></dialogIndex>
</div>
</template>
<script>
import { getList } from "@/views/gridLayout/components/gridLayout"
import { createEachartAreaStyleColor } from "@/views/gridLayout/components/gridLayout"
import dialogIndex from "@/components/News/dialogIndex"
export default {
name: "mesLine",
props:{
gridItem: {
type: Object,
default: () => {
return {}
}
},
//
isHome: {
type: Boolean,
default: () => {
return false
}
},
//
dataSourceId: {
type: String,
default: () => {
return ''
}
}
},
data () {
return {
xAxisData: [],
seriesData: [],
dialogVisible: false,
title: '',
settings:{
lineColorArr:[],
areaStyles:[],
},
}
},
components: {
dialogIndex
},
mounted() {
getList(JSON.parse(localStorage.getItem(this.dataSourceId))).then( rs => {
this.title = rs.title,
this.xAxisData = rs.xAxisData,
this.seriesData = rs.seriesData
this.initSettings()
})
},
methods: {
//
initSettings(){
//
if(this.gridItem.gridSettings){
this.settings = JSON.parse(JSON.stringify(this.gridItem.gridSettings))
setTimeout(() => {
this.drawChart();
},200)
}
else{
//
this.setEchartColor()
}
},
//
setEchartColor(){
let _finalSettings = createEachartAreaStyleColor(this.seriesData)
this.settings.lineColorArr = _finalSettings.lineColorArr
this.settings.areaStyles = []
this.seriesData.forEach((item,key) => {
this.settings.areaStyles.push({
color: new this.$echarts.graphic.LinearGradient(
0,0,0,1, _finalSettings.areaStyles[key].color
)
})
})
setTimeout(() => {
this.drawChart();
},200)
},
drawChart() {
// domecharts main
let myChart = this.$echarts.init(document.getElementById(this.gridItem.name+"-chart"+this.gridItem.i));
//
// seriesData
let series = []
let series_legend = []
this.seriesData.forEach((item,key) => {
series.push({
name: item.name,
data: item.data,
type: 'line',
showSymbol:false,
smooth: true,
stack: "总量",
areaStyle: this.settings.areaStyles[key],
})
series_legend.push(item.name)
})
let option = {
color:this.settings.lineColorArr,
title: {
text: this.title==null?"折线图":this.title,
left:'center',
top:'10',
triggerEvent: this.isHome
},
tooltip: {
trigger: "axis",
},
legend: {
// icon: "circle",//     circlerect roundRecttrianglediamondpinarrownone
align:'left',//
right:'center',
bottom:'10',
data: series_legend,
},
grid: {
left: "30",
right: "30",
bottom: "40",
top:"70",
containLabel: true,
},
xAxis: {
type: "category",
boundaryGap: false,
data: this.xAxisData,
axisLabel: {
show: true,
textStyle: {
color: '#666'
}
},
axisLine: {
lineStyle: {
color: '#ddd',
}
},
axisTick:{
show:false
}
},
yAxis: {
type: "value",
axisLabel: {
show: true,
textStyle: {
color: '#666'
}
},
axisLine: {
lineStyle: {
color: '#fff',
}
},
axisTick:{
show:false
}
},
series: series
}
// 使
myChart.setOption(option);
window.addEventListener('resize',function(){
myChart.resize()
})
myChart.off('click');//
myChart.on('click', params => { //
if (params.componentType === 'title') { // title
this.dialogVisible = true
}
})
},
close() {
this.dialogVisible = false
},
//
getSettings(){
return this.settings
}
}
}
</script>
<style scoped lang="scss">
@import "../gridLayout.scss";
</style>

112
PC/InterFace.Dash/src/views/gridLayout/components/chart/list.vue

@ -1,112 +0,0 @@
<template>
<div style="height:100%" class="chartMainOuter">
<div class="grid-item-header">
<span @click="showNewsClick">{{this.title}}</span>
</div>
<el-table
v-loading="notReadLoading"
:data="tableData"
height="calc(100% - 45px)"
style="width: 100%"
>
<el-table-column
prop="name"
label="名称"
align="center"
:show-overflow-tooltip="true"
/>
<el-table-column
prop="count"
label="数量"
align="center"
:show-overflow-tooltip="true"
>
</el-table-column>
</el-table>
<dialogIndex :dialogVisible="dialogVisible" @close="close"></dialogIndex>
</div>
</template>
<script>
import { getList } from "@/views/gridLayout/components/gridLayout"
import dialogIndex from "@/components/News/dialogIndex"
export default {
name: 'list',
components: {
dialogIndex
},
data() {
return {
dialogVisible: false,
notReadLoading: false,
tableData: [],
title: '',
}
},
props:{
//
isHome: {
type: Boolean,
default: () => {
return false
}
}
},
mounted () {
getList(JSON.parse(localStorage.getItem(this.dataSourceId))).then( rs => {
this.title = rs.title==null?"数据列表":this.title,
this.xAxisData = rs.xAxisData,
this.seriesData = rs.seriesData
this.xAxisData.forEach((item,index) => {
this.tableData.push({
name: item,
count: rs.seriesData[0].data[index]
})
});
})
},
methods: {
showNewsClick() {
if (this.isHome) {
this.dialogVisible = true
}
},
close() {
this.dialogVisible = false
}
}
}
</script>
<style lang="scss" scoped>
@import "../gridLayout.scss";
.grid-item-header{
height: 45px;
line-height: 45px;
padding: 0 15px;
background: #fff;
border-bottom: #ddd solid 1px;
font-weight: bold;
text-align: center;
color: #333;
font-size: 18px;
overflow: hidden;
}
.message-title {
font-size: 16px;
color: #333;
font-weight: bold;
padding-right: 8px;
}
.Footer {
padding: 40px 40px;
display: flex;
justify-content: flex-end;
::v-deep button {
background-color: #fff;
}
::v-deep .number {
background-color: #fff;
}
}
</style>

160
PC/InterFace.Dash/src/views/gridLayout/components/chart/pie.vue

@ -1,160 +0,0 @@
<template>
<div :id="gridItem.name+'-chart'+gridItem.i" class="chartMainOuter">
<dialogIndex :dialogVisible="dialogVisible" @close="close"></dialogIndex>
</div>
</template>
<script>
import { getList } from "@/views/gridLayout/components/gridLayout"
import dialogIndex from "@/components/News/dialogIndex"
import { get_chart_cycleColor_alpha } from "../gridLayout"
export default {
name: "mesPie",
components: {
dialogIndex
},
props:{
gridItem: {
type: Object,
default: () => {
return {}
}
},
//
isHome: {
type: Boolean,
default: () => {
return false
}
},
//
dataSourceId: {
type: String,
default: () => {
return ''
}
}
},
data () {
return {
xAxisData: [],
seriesData: [],
dialogVisible: false,
title: '',
settings:{
colors:[]
},
}
},
mounted() {
getList(JSON.parse(localStorage.getItem(this.dataSourceId))).then( rs => {
this.title = rs.title,
this.xAxisData = rs.xAxisData,
//
this.xAxisData.forEach((item,index) => {
this.seriesData.push({
name: item,
value: rs.seriesData[0].data[index]
})
})
this.initSettings()
})
},
methods: {
//
initSettings(){
//
if(this.gridItem.gridSettings){
this.settings = JSON.parse(JSON.stringify(this.gridItem.gridSettings))
setTimeout(() => {
this.drawChart();
},200)
}
else{
//
this.setEchartColor()
}
},
//
setEchartColor(){
this.settings.colors = []
let _colors = get_chart_cycleColor_alpha(this.seriesData.length,true);
_colors.sort(()=>Math.random() - 0.5)
this.settings.colors = _colors
setTimeout(() => {
this.drawChart();
},200)
},
drawChart() {
// domecharts main
let myChart = this.$echarts.init(document.getElementById(this.gridItem.name+"-chart"+this.gridItem.i));
//
let series = []
series.push({
type: "pie", // type
radius: ["35%","55%"],
center: ['50%', '46%'],
itemStyle: {
borderRadius:10,
borderColor: '#fff',
borderWidth: 2
},
label: {
show: false,
position: 'center'
},
emphasis: {
label: {
show: true,
fontSize: '28',
fontWeight: 'bold',
formatter:'{b}\n{d}%',
}
},
data: this.seriesData
})
const option = {
color: this.settings.colors,
title: {
text: this.title==null?"饼状图":this.title,
left:'center',
top:'10',
triggerEvent: this.isHome
},
tooltip : {
trigger: 'item',
// formatter: "{b}<br/>{c}"
},
legend: {
icon: "circle",
align:'left',//
// orient : 'vertical',
bottom:'30',
data: this.xAxisData
},
series: series
};
// 使
myChart.setOption(option);
window.addEventListener('resize',function(){
myChart.resize()
})
myChart.off('click');//
myChart.on('click', params => { //
if (params.componentType === 'title') { // title
this.dialogVisible = true
}
})
},
close() {
this.dialogVisible = false
},
//
getSettings(){
return this.settings
}
}
}
</script>
<style lang="scss" scoped>
@import "../gridLayout.scss";
</style>

196
PC/InterFace.Dash/src/views/gridLayout/components/dataSource.vue

@ -1,196 +0,0 @@
<template>
<div>
<el-dialog :visible.sync="dataSourceDialogVisible" width="40%" top="8vh" append-to-body>
<div slot="title">
<span style="padding-right: 10px;">数据源配置-{{ this.dataSourceId }}</span>
</div>
<el-form :model="form" :rules="rules" ref="form" label-width="80px">
<el-form-item label="图形标题" prop="title">
<el-input v-model="form.title" placeholder="图形标题"></el-input>
</el-form-item>
<el-form-item label="请求地址" prop="url">
<el-input v-model="form.url" placeholder="请求地址" >
<template slot="prepend">api/</template>
</el-input>
</el-form-item>
<el-form-item label="请求类型">
<el-radio-group v-model="form.type">
<el-radio-button label="get" value="get"></el-radio-button>
<el-radio-button label="post" value="post"></el-radio-button>
</el-radio-group>
</el-form-item>
<!-- <el-form-item label="请求参数">
<el-button type="success" @click="addTableData">新增</el-button>
</el-form-item> -->
<el-button type="text" @click="addTableData">+ 新增请求参数</el-button>
<el-table
:data="tableData"
style="width: 100%"
max-height="250"
>
<el-table-column fixed="left" label="序号" width="50" >
<template slot-scope="scop">
{{scop.$index+1}}
</template>
</el-table-column>
<el-table-column
prop="name"
label="名称"
width="210">
<template slot-scope="scope">
<el-input v-model="scope.row.name" placeholder="名称"></el-input>
</template>
</el-table-column>
<el-table-column
prop="value"
label="值"
width="210">
<template slot-scope="scope">
<el-input v-model="scope.row.value" placeholder="值"></el-input>
</template>
</el-table-column>
<el-table-column
fixed="right"
label="操作"
width="150">
<template slot-scope="scope">
<el-button @click="handleClick(scope)" icon="el-icon-delete" size="small" circle></el-button>
</template>
</el-table-column>
</el-table>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="closeDataSource"> </el-button>
<el-button type="primary" @click="save('form')"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default {
name: 'dataSource',
data() {
return {
DialogLoading: false,
tableData: [],
form: {
title: '',
url: '',
type: 'post',
},
//table
childTableData: [
{
name: '',
value: '',
}
],
rules: {
url: [
{
required: true,
message: '请求地址不能为空',
trigger: 'blur',
},
]
}
}
},
props:{
dataSourceDialogVisible: {
type: Boolean,
default: () => {
return false
}
},
dataSourceId: {
type: String,
default: () => {
return ''
}
}
},
watch: {
dataSourceDialogVisible (){
this.getList()
}
},
mounted () {
},
methods: {
getList(){
let rs = JSON.parse(localStorage.getItem(this.dataSourceId))
if (rs) {
this.form.title = rs.title
this.form.url = rs.url
this.form.type = rs.type
this.tableData = rs.tableData
} else {
this.form.title = ''
this.form.url = ''
this.form.type = 'post'
this.tableData = []
}
},
addTableData() {
let data = JSON.parse(JSON.stringify(...this.childTableData))
this.tableData.push(data)
},
save(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
//
//
// id
// gridLayoutId : this.dataSourceId
// work
// requestType this.form.type ----- post get
// requestUrl this.form.url ------ url
// requestParams this.tableData ----- json [{name:11,value:12},{name:22,value:33}]
let rs = {
title: this.form.title,
type: this.form.type,
url: this.form.url,
tableData: this.tableData
}
localStorage.setItem(this.dataSourceId,JSON.stringify(rs))
this.$message.success('数据源配置成功')
this.closeDataSource()
}
})
},
closeDataSource() {
this.$refs['form'].resetFields()
this.tableData = []
this.$emit('closeDataSource')
},
handleClick(row) {
this.tableData.splice(row.$index, 1)
}
}
}
</script>
<style lang="scss" scoped>
.message-title {
font-size: 16px;
color: #333;
font-weight: bold;
padding-right: 8px;
}
.Footer {
padding: 40px 40px;
display: flex;
justify-content: flex-end;
::v-deep button {
background-color: #fff;
}
::v-deep .number {
background-color: #fff;
}
}
</style>

58
PC/InterFace.Dash/src/views/gridLayout/components/grid-demo.vue

@ -1,58 +0,0 @@
<template>
<div :id="gridItem.name+'-chart'+gridItem.i" class="chartMainOuter"></div>
</template>
<script>
export default {
name: "demo",
props:{
gridItem: {
type: Object,
default: () => {
return {}
}
},
},
mounted() {
// setTimeout
setTimeout(()=>{
this.drawChart();
},0)
},
methods: {
drawChart() {
// domecharts main
let myChart = this.$echarts.init(document.getElementById(this.gridItem.name+"-chart"+this.gridItem.i));
//
let option = {
title: {
text: "消息待办-柱状图",
},
tooltip: {},
legend: {
data: ["销量"],
},
xAxis: {
data: ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"],
},
yAxis: {},
series: [
{
name: "销量",
type: "bar",
data: [5, 20, 36, 10, 10, 20],
},
],
};
// 使
myChart.setOption(option);
//
window.addEventListener('resize',function(){
myChart.resize()
})
},
}
}
</script>
<style lang="scss" scoped>
@import "gridLayout.scss";
</style>

131
PC/InterFace.Dash/src/views/gridLayout/components/gridLayout.js

@ -1,131 +0,0 @@
import request from '@/utils/request'
// echart的重新渲染
export function gridLayout_chart_resize(dom) {
dom.resize()
}
// 循环颜色(支持透明度)
/**
* 循环echart图的颜色(支持透明度)
* @param {*} number 一共需要多少个颜色可以不传不传默认返回全部1组颜色
* @param {*} isCreate 是否直接生成rgba颜色true:返回['rgba(1,110,224)']格式,false:返回[{r:"1",g:"110",b:"244"}]格式
* @param {*} alpha 透明度默认为1直接生成rgba颜色值参数为真时使用
* @param {*} colors 自定义颜色组,color格式必须为[{r:"1",g:"110",b:"244"}]
* @param {*} append 是否追加truecolors值将追加进去 false:返回值直接用colors代替
* @returns
*/
export function get_chart_cycleColor_alpha(number,isCreate,alpha = 1,colors,append){
// let _color_item = {
// r:parseInt(Math.random() * 255),
// g:parseInt(Math.random() * 255),
// b:parseInt(Math.random() * 255)
// }
// let _colors = colors || ['#3ca170','#5470c6', '#91cd77','#ef6567', '#f9c956','#75bedc','#529FDB','#FF8000','#88D36C','#FCC12B',
// '#D38C6C','#AB9DF3','#40C03A','#ED94F5','#6CBED3']
let _colors = [
{r:"84",g:"112",b:"198"},
{r:"171",g:"157",b:"243"},
{r:"237",g:"148",b:"245"},
{r:"1",g:"110",b:"244"},
{r:"82",g:"159",b:"219"},
{r:"108",g:"190",b:"211"},
{r:"60",g:"161",b:"112"},
{r:"64",g:"192",b:"58"},
{r:"136",g:"211",b:"108"},
// {r:"145",g:"205",b:"119"},
{r:"211",g:"140",b:"108"},
{r:"239",g:"101",b:"103"},
// {r:"249",g:"201",b:"86"},
// {r:"117",g:"190",b:"220"},
{r:"255",g:"128",b:"0"},
{r:"252",g:"193",b:"43"},
]
if(colors){_colors = append ? _colors.concat(colors) : colors}
let _all = []
let _length = number ? Math.ceil(number/_colors.length) : 1
for(let i = 0;i<_length;i++){
_all= _all.concat(_colors)
}
if(isCreate){
let _create = []
_all.forEach(item=>{
let _item = `rgba(${item.r},${item.g},${item.b},${alpha})`
_create.push(_item)
})
_all = _create
}
return _all
}
// 模块获取数据
export function getList(dataSource){
return new Promise((resolve, reject) => {
if (dataSource) {
const params = {}
dataSource.tableData.forEach(item => {
params[item.name] = item.value
})
getGridLayout(dataSource.url, dataSource.type, params).then( res => {
// TODO:赋值获取后端数据
const rs = {
title: dataSource.title,
xAxisData: res.xAxisData, // ['a','b','c','d','e','f']
seriesData: res.seriesData // [{name:'说明1',data:[1,2,3,4,5,6]},{name:'说明2',data:[3,4,10,12,1,5]}]
}
resolve(rs)
})
} else {
// 默认静态数据
const rs = {
xAxisData: ['a','b','c','d','e','f'],
seriesData: [{name:'说明1',data:[1,2,3,4,5,6]},{name:'说明2',data:[3,4,10,12,1,5]}]
}
resolve(rs)
}
})
}
// 数据源请求接口
function getGridLayout(url, method, params) {
return request({
url: localStorage.getItem('base') + '/api/' + url,
method: method,
params: params
})
}
// 颜色选择器-预订颜色
export function getPredefineColors(number,iscreate = true,alpha = 1) {
return get_chart_cycleColor_alpha(number,iscreate,alpha,[
{r:"255",g:"255",b:"255"},
{r:"102",g:"102",b:"102"},
{r:"0",g:"0",b:"0"},
],true)
}
// 循环随机颜色echart配置
export function createEachartAreaStyleColor(seriesData,alpha1=0.8,alpha2=0.2){
let _settings = {
lineColorArr:[],
areaStyles:[],
}
// 生成颜色
function __createRgbaColor(color,alpha = 0.8,append){
let _item = `rgba(${color.r},${color.g},${color.b},${alpha})`
if(append)_settings.lineColorArr.push(_item)
return _item
}
seriesData.forEach((item) => {
let _colors = get_chart_cycleColor_alpha(seriesData.length)
let _color_item = _colors[parseInt(Math.random() * _colors.length)]
_settings.areaStyles.push({
color:[{
offset: 0,
color: __createRgbaColor(_color_item,alpha1,true)
}, {
offset: 1,
color: __createRgbaColor(_color_item,alpha2)
}]
})
})
return _settings
}

59
PC/InterFace.Dash/src/views/gridLayout/components/gridLayout.scss

@ -1,59 +0,0 @@
// echart外部框样式
.chartMainOuter{
width: 100%;
height: 100%;
background: #fff;
box-shadow: 2px 2px 10px #ddd;
}
// 编辑按钮
.gridItem-edit-button{
position: absolute;
left: 0;
top: 0;
box-shadow: 1px 1px 5px #aaa;
margin: 0 !important;
}
// 删除按钮
.gridItem-remove-button {
position: absolute;
right: 0px;
top: 0px;
box-shadow: 1px 1px 5px #aaa;
margin: 0;
}
// 刷新按钮
.gridItem-refresh-button{
position: absolute;
left: 40px;
top: 0;
box-shadow: 1px 1px 5px #aaa;
margin: 0 !important;
}
// 更多配置内标题样式
.gridLayout-editTitle-line{
width: 100%;
margin-top: 50px;
border-top: #ddd solid 1px;
padding: 10px 20px;
font-weight: bold;
position: relative;
&:first-child{
margin-top: 0;
}
&::before{
content: "";
position: absolute;
left: 8px;
top: 13px;
width: 3px;
height: 14px;
background: #409EFF;
}
}
// 颜色选择器-预设值方块
.el-color-predefine__color-selector{
border: #eee solid 1px;
box-sizing: border-box;
}

500
PC/InterFace.Dash/src/views/gridLayout/index.vue

@ -1,500 +0,0 @@
<template>
<div class="gridlayoutEditPage">
<!-- <div>
<div class="layoutJSON">
Displayed as <code>[x, y, w, h]</code>:
<div class="columns">
<div class="layoutItem" v-for="item in layout" :key="item.i" >
<b>{{ item.i }}</b>: [{{ item.x }}, {{ item.y }}, {{ item.w }}, {{ item.h }}]
</div>
</div>
</div>
</div>
<br/> -->
<!-- 左侧列表 -->
<div class="leftNav" v-if="!isHome">
<!-- 左侧菜单 -->
<el-collapse class="navList">
<el-collapse-item
v-for="(item,index) in navList"
:key="index"
:title="item.label"
:name="item.name"
>
<div
v-for="(item2,index2) in item.inner"
:key="index2"
@drag="drag(item2,item,arguments)"
@dragend="dragend(item2,item,arguments)"
class="droppable-element"
draggable="true"
unselectable="on"
>{{item2.title}}</div>
</el-collapse-item>
</el-collapse>
<!-- 左侧按钮 -->
<div class="btnBox" style="display:flex">
<!-- <el-button type="success" @click="viewHandle(true)" icon="el-icon-view" circle></el-button> -->
<el-button type="success" @click="viewHandle(true)">预览</el-button>
<el-button type="primary" style="width:calc(100% - 95px)" @click="save">保存</el-button>
</div>
</div>
<!-- 右侧编辑处 -->
<div class="rightContain" :style="{padding:!isHome ? '20px' : ''}">
<div
id="content"
class="editContent"
:class="[!isHome ? 'editContent-bg':'']"
>
<grid-layout ref="gridlayout" :layout.sync="layout"
:col-num="12"
:row-height="30"
:is-draggable="!isHome"
:is-resizable="!isHome"
:responsive="false"
:vertical-compact="false"
:prevent-collision="false"
:use-css-transforms="true"
:margin="[20, 20]"
>
<grid-item :key="item.i" v-for="item in layout"
:x="item.x"
:y="item.y"
:w="item.w"
:h="item.h"
:i="item.i"
@resize="resizedEvent(item,arguments)"
@resized="resizedEvent(item,arguments)"
>
<!-- 标题/文本 -->
<gridText v-if="item.name=='gridText' || item.name=='gridTitle'" :gridItem="item" :isHome="isHome" :ref="'ref-'+item.name+item.i"></gridText>
<!-- 数值统计 -->
<statistics v-else-if="item.name=='statistics'" :gridItem="item" :isHome="isHome" :ref="'ref-'+item.name+item.i"></statistics>
<!-- 倒计时 -->
<countDown v-else-if="item.name=='countDown'" :gridItem="item" :isHome="isHome" :ref="'ref-'+item.name+item.i"></countDown>
<!-- 消息待办-饼状图 -->
<chartPie v-else-if="item.name=='pie'" :gridItem="item" :isHome="isHome" :ref="'ref-'+item.name+item.i" :dataSourceId ="item.name+item.i"></chartPie>
<!-- 消息待办-柱状图 -->
<chartBar v-else-if="item.name=='bar'" :gridItem="item" :isHome="isHome" :ref="'ref-'+item.name+item.i" :dataSourceId ="item.name+item.i"></chartBar>
<!-- 消息待办-折线图 -->
<chartLine v-else-if="item.name=='line'" :gridItem="item" :isHome="isHome" :ref="'ref-'+item.name+item.i" :dataSourceId ="item.name+item.i"></chartLine>
<!-- 消息待办-列表 -->
<chartList v-else-if="item.name=='list'" :gridItem="item" :isHome="isHome" :ref="'ref-'+item.name+item.i" :dataSourceId ="item.name+item.i"></chartList>
<div class="dragOuter" v-else>
{{ item.name }}
</div>
<!-- 删除 -->
<el-button
v-if="!isHome"
type="danger"
icon="el-icon-delete"
circle
class="gridItem-remove-button"
@click="removeItem(item.i)"
size="mini"
></el-button>
<!-- 数据源配置 -->
<el-button
v-if="!isHome && (item.type=='echarts' || item.name=='list')"
type="warning"
icon="el-icon-edit"
circle
class="gridItem-edit-button"
@click="editItem(item.i)"
size="mini"
></el-button>
<!-- 颜色刷新 -->
<el-button
v-if="!isHome && (item.type=='echarts')"
type="success"
icon="el-icon-refresh"
circle
class="gridItem-refresh-button"
@click="refreshItem(item)"
size="mini"
></el-button>
</grid-item>
</grid-layout>
</div>
</div>
<dataSource :dataSourceDialogVisible="dataSourceDialogVisible" :dataSourceId="dataSourceId" @closeDataSource="closeDataSource"></dataSource>
</div>
</template>
<script>
import { mapGetters } from "vuex";
import {GridLayout, GridItem} from "vue-grid-layout"
import gridText from "@/views/gridLayout/components/baseConfig/gridText"
import statistics from "@/views/gridLayout/components/baseConfig/statistics"
import countDown from "@/views/gridLayout/components/baseConfig/countDown"
import chartList from "@/views/gridLayout/components/chart/list"
import chartBar from "@/views/gridLayout/components/chart/bar"
import chartPie from "@/views/gridLayout/components/chart/pie"
import chartLine from "@/views/gridLayout/components/chart/line"
import dataSource from "@/views/gridLayout/components/dataSource"
import { gridLayout_chart_resize } from "./components/gridLayout"
export default {
name:"Gridlayout",
components: {
GridLayout,
GridItem,
gridText,
statistics,
countDown,
chartList,
chartBar,
chartPie,
chartLine,
dataSource
},
watch:{
// echart
'sidebar.opened'(){
setTimeout(()=>{
this.layout.forEach(item=>{
if(item.type == "echarts"){
this.resizedEvent(item)
}
})
},100)
}
},
computed: {
...mapGetters(["sidebar"]),
},
props: {
//
isHome: {
type: Boolean,
default: () => {
return false
}
}
},
data() {
return {
DragPosW: 5,
DragPosH: 10,
mouseXY: {
"x": null,
"y": null
},
DragPos: {
"x": null,
"y": null,
// "w": this.DragPosW,
// "h": this.DragPosH,
"i": null
},
navList:[
{label:'基础组件',name:'title',inner:[
{title:'标题',name:'gridTitle'},
{title:'文本',name:'gridText'},
{title:'数值统计',name:'statistics'},
{title:'倒计时',name:'countDown'},
]},
{label:'图表组件',name:'chart',inner:[
{title:'饼状图',name:'pie',type:"echarts"},
{title:'柱状图',name:'bar',type:"echarts"},
{title:'折线图',name:'line',type:"echarts"},
{title:'列表',name:'list'},
]},
],
layout: [
// {"x": 0, "y": 0, "w": 2, "h": 2, "i": "0"},
],
index: 0,
//
dataSourceDialogVisible: false,
// pie , bar, line
dataSourceId: '',
showView:false
}
},
mounted() {
let that = this
document.addEventListener("dragover", function (e) {
that.mouseXY.x = e.clientX;
that.mouseXY.y = e.clientY;
}, false);
//
let _defaultData = [
{"x":0,"y":8,"w":3,"h":7,"i":0,"name":"line","moved":false,"type":"echarts","gridSettings":{"lineColorArr":["rgba(171,157,243,0.8)","rgba(136,211,108,0.8)"],"areaStyles":[{"color":{"x":0,"y":0,"x2":0,"y2":1,"type":"linear","global":false,"colorStops":[{"offset":0,"color":"rgba(171,157,243,0.8)"},{"offset":1,"color":"rgba(171,157,243,0.2)"}]}},{"color":{"x":0,"y":0,"x2":0,"y2":1,"type":"linear","global":false,"colorStops":[{"offset":0,"color":"rgba(136,211,108,0.8)"},{"offset":1,"color":"rgba(136,211,108,0.2)"}]}}]}},
{"x":7,"y":4,"w":5,"h":7,"i":1,"name":"line","moved":false,"type":"echarts","gridSettings":{"lineColorArr":["rgba(249,201,86,0.8)","rgba(117,190,220,0.8)"],"areaStyles":[{"color":{"x":0,"y":0,"x2":0,"y2":1,"type":"linear","global":false,"colorStops":[{"offset":0,"color":"rgba(249,201,86,0.8)"},{"offset":1,"color":"rgba(249,201,86,0.2)"}]}},{"color":{"x":0,"y":0,"x2":0,"y2":1,"type":"linear","global":false,"colorStops":[{"offset":0,"color":"rgba(117,190,220,0.8)"},{"offset":1,"color":"rgba(117,190,220,0.2)"}]}}]}},
{"x":0,"y":15,"w":3,"h":6,"i":2,"name":"line","moved":false,"type":"echarts","gridSettings":{"lineColorArr":["rgba(117,190,220,0.8)","rgba(255,128,0,0.8)"],"areaStyles":[{"color":{"x":0,"y":0,"x2":0,"y2":1,"type":"linear","global":false,"colorStops":[{"offset":0,"color":"rgba(117,190,220,0.8)"},{"offset":1,"color":"rgba(117,190,220,0.2)"}]}},{"color":{"x":0,"y":0,"x2":0,"y2":1,"type":"linear","global":false,"colorStops":[{"offset":0,"color":"rgba(255,128,0,0.8)"},{"offset":1,"color":"rgba(255,128,0,0.2)"}]}}]}},
{"x":3,"y":8,"w":4,"h":13,"i":3,"name":"pie","moved":false,"type":"echarts","gridSettings":{"colors":["rgba(82,159,219,1)","rgba(64,192,58,1)","rgba(255,128,0,1)","rgba(1,110,244,1)","rgba(136,211,108,1)","rgba(239,101,103,1)","rgba(237,148,245,1)","rgba(252,193,43,1)","rgba(171,157,243,1)","rgba(60,161,112,1)","rgba(211,140,108,1)","rgba(108,190,211,1)","rgba(84,112,198,1)"]}},
{"x":7,"y":11,"w":5,"h":10,"i":4,"name":"line","moved":false,"type":"echarts","gridSettings":{"lineColorArr":["rgba(84,112,198,0.8)","rgba(249,201,86,0.8)"],"areaStyles":[{"color":{"x":0,"y":0,"x2":0,"y2":1,"type":"linear","global":false,"colorStops":[{"offset":0,"color":"rgba(84,112,198,0.8)"},{"offset":1,"color":"rgba(84,112,198,0.2)"}]}},{"color":{"x":0,"y":0,"x2":0,"y2":1,"type":"linear","global":false,"colorStops":[{"offset":0,"color":"rgba(249,201,86,0.8)"},{"offset":1,"color":"rgba(249,201,86,0.2)"}]}}]}},
{"x":8,"y":23,"w":4,"h":10,"i":5,"name":"bar","moved":false,"type":"echarts","gridSettings":{"lineColorArr":["rgba(211,140,108,0.8)","rgba(117,190,220,0.8)"],"areaStyles":[{"color":{"x":0,"y":0,"x2":0,"y2":1,"type":"linear","global":false,"colorStops":[{"offset":1,"color":"rgba(211,140,108,0.8)"},{"offset":0,"color":"rgba(211,140,108,0.4)"}]}},{"color":{"x":0,"y":0,"x2":0,"y2":1,"type":"linear","global":false,"colorStops":[{"offset":1,"color":"rgba(117,190,220,0.8)"},{"offset":0,"color":"rgba(117,190,220,0.4)"}]}}]}},
{"x":5,"y":23,"w":3,"h":10,"i":6,"name":"list","moved":false},
{"x":0,"y":4,"w":7,"h":2,"i":7,"name":"statistics","moved":false,"gridSettings":{"numberConfig":[{"number":"111.15115415","value":111.2,"numberStyle":{"fontSize":"20px","color":"#ff9000","fontWeight":"bold"},"groupSeparator":",","decimalSeparator":".","precision":"1","prefix":"","suffix":""},{"number":"222.22555555","value":222.23,"numberStyle":{"fontSize":"20px","color":"rgba(0, 206, 209, 1)","fontWeight":"normal"},"groupSeparator":",","decimalSeparator":".","precision":"2","prefix":"","suffix":""},{"number":"333.5415453","value":333.542,"numberStyle":{"fontSize":"20px","color":"#303133","fontWeight":"bold"},"groupSeparator":",","decimalSeparator":".","precision":"3","prefix":"","suffix":""},{"number":"444.445452524","value":444.4455,"numberStyle":{"fontSize":"20px","color":"#ff9000","fontWeight":"normal"},"groupSeparator":",","decimalSeparator":".","precision":"4","prefix":"","suffix":""}],"title":"今年增长数","titleStyle":{"fontSize":"14px","color":"#666","lineHeight":"24px","fontWeight":"bold"},"boxShadow":true,"numberSuffix":"—"}},
{"x":0,"y":6,"w":3,"h":2,"i":8,"name":"statistics","moved":false,"gridSettings":{"numberConfig":[{"number":"11111.515515","value":11112,"numberStyle":{"fontSize":"20px","color":"#409EFF","fontWeight":"bold"},"groupSeparator":",","decimalSeparator":".","precision":"0","prefix":"","suffix":"个"}],"title":"开始数值","titleStyle":{"fontSize":"14px","color":"#666","lineHeight":"24px","fontWeight":"bold"},"boxShadow":true,"numberSuffix":"—"}},
{"x":0,"y":0,"w":12,"h":1,"i":9,"name":"gridTitle","moved":false,"gridSettings":{"text":"数据汇总图表","fontSize":"22px","fontColor":"#2f80ea","lineHeight":"34px","fontWeight":"bold","boxShadow":false,"centerValue":"center"}},
{"x":0,"y":1,"w":12,"h":3,"i":10,"name":"gridText","moved":false,"gridSettings":{"text":"百度(Baidu)是拥有强大互联网基础的领先AI公司。百度愿景是:成为最懂用户,并能帮助人们成长的全球顶级高科技公司。 [1] “百度”二字,来自于八百年前南宋词人辛弃疾的一句词:众里寻他千百度。这句话描述了词人对理想的执着追求。1999年底,身在美国硅谷的李彦宏看到了中国互联网及中文搜索引擎服务的巨大发展潜力,抱着技术改变世界的梦想,他毅然辞掉硅谷的高薪工作,携搜索引擎专利技术,于 2000年1月1日在中关村创建了百度公司。 百度拥有数万名研发工程师,这是中国乃至全球都顶尖的技术团队。这支队伍掌握着世界上最为先进的搜索引擎技术,使百度成为中国掌握世界尖端科学核心技术的中国高科技企业,也使中国成为美国、俄罗斯和韩国之外,全球仅有的4个拥有搜索引擎核心技术的国家之一。 [1] ","fontSize":"14px","fontColor":"#666","lineHeight":"30px","fontWeight":"normal","boxShadow":false,"centerValue":"left"}},
{"x":0,"y":21,"w":12,"h":2,"i":11,"name":"gridText","moved":false,"gridSettings":{"text":"「路漫漫其修远兮,吾将上下而求索」 古有屈原天问,后世登月问天 心之所向,所以求索不止,行之所至 现在,文心一言与搜索整合 从心之所向到「心」之「索」向 共同探索更广阔的世界 我们,一言为定 ​​​","fontSize":"12px","fontColor":"#666","lineHeight":"34px","fontWeight":"bold","boxShadow":true,"centerValue":"center"}},
{"x":3,"y":6,"w":4,"h":2,"i":12,"name":"countDown","moved":false,"gridSettings":{"value":1678438800000,"valueStyle":{"fontSize":"24px","color":"rgba(255, 69, 0, 1)","fontWeight":"bold"},"title":"倒计时","titleStyle":{"fontSize":"14px","color":"#666","lineHeight":"24px","fontWeight":"bold"},"format":"HH:mm:ss","boxShadow":true}},
{"x":0,"y":23,"w":5,"h":10,"i":13,"name":"bar","type":"echarts","moved":false,"gridSettings":{"lineColorArr":["rgba(60,161,112,0.8)","rgba(249,201,86,0.8)"],"areaStyles":[{"color":{"x":0,"y":0,"x2":0,"y2":1,"type":"linear","global":false,"colorStops":[{"offset":1,"color":"rgba(60,161,112,0.8)"},{"offset":0,"color":"rgba(60,161,112,0.4)"}]}},{"color":{"x":0,"y":0,"x2":0,"y2":1,"type":"linear","global":false,"colorStops":[{"offset":1,"color":"rgba(249,201,86,0.8)"},{"offset":0,"color":"rgba(249,201,86,0.4)"}]}}]}}
]
this.layout = localStorage.getItem('gridLayoutConfig')==null?_defaultData:JSON.parse(localStorage.getItem('gridLayoutConfig'))
let indexMax = 0
this.layout.forEach(item => {
if (item.i > indexMax) {
indexMax = item.i
}
})
this.index = indexMax + 1
},
beforeDestroy() {
},
methods: {
//
viewHandle(show){
this.$emit('isViewHanlde',show,this.layout,)
},
//
setDragPosWH(item){
let _DragPosWH = {
w:this.DragPosW,
h:this.DragPosH
}
switch (item.name){
//
case "gridTitle":
//
case "gridText":
_DragPosWH.w = 12;
_DragPosWH.h = 1;
break;
//
case "statistics":
//
case "countDown":
_DragPosWH.w = 4;
_DragPosWH.h = 2;
break;
}
return _DragPosWH
},
drag: function (item,itemParent,e) {
let _DragPosW = this.setDragPosWH(item).w,
_DragPosH = this.setDragPosWH(item).h
let parentRect = document.getElementById('content').getBoundingClientRect();
let mouseInGrid = false;
if (((this.mouseXY.x > parentRect.left) && (this.mouseXY.x < parentRect.right)) && ((this.mouseXY.y > parentRect.top) && (this.mouseXY.y < parentRect.bottom))) {
mouseInGrid = true;
}
if (mouseInGrid === true && (this.layout.findIndex(item => item.i === 'drop')) === -1) {
this.layout.push({
x: (this.layout.length * 2) % (this.colNum || 12),
y: this.layout.length + (this.colNum || 12), // puts it at the bottom
w: _DragPosW,
h: _DragPosH,
i: 'drop',
});
}
let index = this.layout.findIndex(item => item.i === 'drop');
if (index !== -1) {
try {
this.$refs.gridlayout.$children[this.layout.length].$refs.item.style.display = "none";
} catch {
}
let el = this.$refs.gridlayout.$children[index];
el.dragging = {"top": this.mouseXY.y - parentRect.top, "left": this.mouseXY.x - parentRect.left};
let new_pos = el.calcXY(this.mouseXY.y - parentRect.top, this.mouseXY.x - parentRect.left);
if (mouseInGrid === true) {
this.$refs.gridlayout.dragEvent('dragstart', 'drop', new_pos.x, new_pos.y, _DragPosH, _DragPosW);
this.DragPos.i = String(index);
this.DragPos.x = this.layout[index].x;
this.DragPos.y = this.layout[index].y;
}
if (mouseInGrid === false) {
this.$refs.gridlayout.dragEvent('dragend', 'drop', new_pos.x, new_pos.y, _DragPosH, _DragPosW);
this.layout = this.layout.filter(obj => obj.i !== 'drop');
}
}
},
dragend: function (item,itemParent, e) {
// if (this.index > 10) {
// this.$alert('10')
// return
// }
let _DragPosW = this.setDragPosWH(item).w,
_DragPosH = this.setDragPosWH(item).h
let parentRect = document.getElementById('content').getBoundingClientRect();
let mouseInGrid = false;
if (((this.mouseXY.x > parentRect.left) && (this.mouseXY.x < parentRect.right)) && ((this.mouseXY.y > parentRect.top) && (this.mouseXY.y < parentRect.bottom))) {
mouseInGrid = true;
}
if (mouseInGrid === true) {
// alert(`Dropped element props:\n${JSON.stringify(DragPos, ['x', 'y', 'w', 'h'], 2)}`);
this.$refs.gridlayout.dragEvent('dragend', 'drop', this.DragPos.x, this.DragPos.y, _DragPosH, _DragPosW);
this.layout = this.layout.filter(obj => obj.i !== 'drop');
this.layout.push({
x: this.DragPos.x,
y: this.DragPos.y,
w: _DragPosW,
h: _DragPosH,
// i: DragPos.i,
i: this.index, //
name: item.name,
type: item.type
});
this.index++
// this.$refs.gridLayout.dragEvent('dragend', DragPos.i, DragPos.x,DragPos.y,1,1);
try {
this.$refs.gridLayout.$children[this.layout.length].$refs.item.style.display="block";
} catch {
}
}
},
// echart
resizedEvent: function(item){
if(item.type != 'echarts') return
let dom = this.$refs['ref-'+item.name+item.i]
if(dom && dom[0]){
gridLayout_chart_resize(this.$echarts.init(document.getElementById(item.name+"-chart"+item.i)))
}
},
//
removeItem: function (val) {
this.$confirm('您确定删除吗, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const index = this.layout.map(item => item.i).indexOf(val);
this.layout.splice(index, 1);
}).catch(() => {
});
},
//
refreshItem(item){
if(item.type != 'echarts') return
let dom = this.$refs['ref-'+item.name+item.i]
if(dom && dom[0]){
dom[0].setEchartColor(item)
}
},
//
closeDataSource() {
this.dataSourceDialogVisible = false
},
editItem (val) {
const index = this.layout.map(item => item.i).indexOf(val)
this.dataSourceId = this.layout[index].name + this.layout[index].i
this.dataSourceDialogVisible = true
},
//
save() {
// //
this.layout.forEach((item,key)=>{
if(
this.$refs['ref-'+item.name+item.i] &&
this.$refs['ref-'+item.name+item.i].length > 0 &&
this.$refs['ref-'+item.name+item.i][0].getSettings
){
this.layout[key]['gridSettings'] = this.$refs['ref-'+item.name+item.i][0].getSettings()
}
})
localStorage.setItem('gridLayoutConfig', JSON.stringify(this.layout))
this.$message.success('保存成功')
}
}
}
</script>
<style lang="scss">
@import "components/gridLayout.scss";
/* 右侧固定框背景色 */
.gridlayoutEditPage .vue-grid-item{
touch-action: none;
border: none !important;
.vue-grid-placeholder{
background: #777 !important;
}
}
</style>
<style lang="scss" scoped>
//
.gridlayoutEditPage{
::-webkit-scrollbar {
width: 5px;
height: 5px;
}
::-webkit-scrollbar-thumb {
border-radius: 10px;
background-color:#ddd;
}
user-select: none;
display: flex;
width: 100%;
height: 100%;
background: #fff;
overflow: hidden;
.leftNav{
width: 240px;
flex-shrink: 0;
padding: 5px 0 20px 20px;
box-shadow: 1px 1px 5px #ddd;
border:solid 1px #eee;
.navList{
height: calc(100% - 60px);
list-style: none;
padding: 0;
margin: 0 0 25px 0;
overflow: auto;
border: none;
.droppable-element {
margin: 0;
padding: 5px 0;
text-align: center;
width: calc(100% - 20px);
border:solid 1px #ddd;
color: #666;
cursor: pointer;
margin-bottom: 12px;
&:hover{
border-color: #409eff;
color: #409eff;
box-shadow: 1px 1px 5px #ddd;
}
}
}
}
.rightContain{
width: 100%;
height: 100%;
overflow: auto;
min-height: 100%;
padding-top: 10px;
.editContent{
min-height: calc(100% - 50px);
&.editContent-bg{
min-height: 100%;
background-color: #efefef;
background-image: linear-gradient(#f8f8f8 20px,transparent 0),linear-gradient(90deg,#f8f8f8 20px,transparent 0);
background-size: calc(8.43333% - 3px) 50px;
}
}
//
.vue-grid-item:not(.vue-grid-placeholder) {
background: #eee;
border: 1px solid #ddd;
.dragOuter{
height: 100%;
width: 100%;
}
}
}
}
</style>

100
PC/InterFace.Dash/src/views/gridLayout/indexShow.vue

@ -1,100 +0,0 @@
<template>
<div style="height:100%;width:100%">
<gridLayout
v-if="!showView"
:isHome="false"
@isViewHanlde="isViewHanlde"
ref="gridLayoutRef"
>
</gridLayout>
<!-- 预览 -->
<gridLayout
v-if="showView"
:isHome="true"
ref="gridLayoutRef"
>
</gridLayout>
<!-- 左下预览返回按钮 -->
<el-button
v-if="showView"
type="danger"
class="closeViewBtn"
@click="isViewHanlde(false)"
>取消预览</el-button>
<!-- 右上预览返回按钮x -->
<el-button
v-if="showView"
icon="el-icon-close"
class="closeViewBtn-close"
@click="isViewHanlde(false)"
circle
size="mini"
></el-button>
</div>
</template>
<script>
import gridLayout from "@/views/gridLayout/index"
export default {
name:"Gridlayout",
//
beforeRouteLeave(to,from,next){
// tag
let hasTag = false
this.$store.state.tagsView.visitedViews.forEach((item)=>{
if(item.path == '/gridlayout'){
hasTag = true
return
}
})
if(!hasTag){ next();return}
if(from.path == '/gridlayout' && !this.isHome){
this.$confirm('请确定是否已保存,离开后操作将丢失,是否确定离开此页?', '提示', {
confirmButtonText: '确定离开',
cancelButtonText: '留在此页',
type: 'warning'
}).then(() => {
next()
}).catch((action) => {
//console.log(action)
});
}else{
next()
}
},
components: {
gridLayout
},
data(){
return {
showView:false,
pageData:null,
}
},
methods: {
isViewHanlde(show,list){
if(list)this.pageData = list
this.showView = show
setTimeout(()=>{
this.pageData.forEach(item=>{
if(item.type == "echarts"){
this.$refs.gridLayoutRef.resizedEvent(item)
}
})
},100)
}
}
}
</script>
<style scoped lang="scss">
.closeViewBtn{
position: absolute;
left: 30px;
bottom: 35px;
}
.closeViewBtn-close{
position: absolute;
top: 30px;
right: 40px;
}
</style>

140
PC/InterFace.Dash/src/views/profileuser/index.vue

@ -1,140 +0,0 @@
<template>
<div class="app-container">
<el-row :gutter="20">
<el-col :span="6" :xs="24">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span style="font-size: 18px">个人信息</span>
</div>
<!-- <div>
{{ $t("wms20.itemCode") }}
</div> -->
<div style="padding-bottom:70px">
<!-- <div class="text-center">
<img src="../../../static/image/common/f778738c-e4f8-4870-b634-56703b4acafe.gif" title="点击上传头像" class="img-circle img-lg" />
</div> -->
<ul class="list-group list-group-striped">
<li class="list-group-item">
<div class="left"><i class="icon el-icon-user-solid"></i></div>
<!-- <div class="title-row"><svg-icon icon-class="user" /> 账号</div> -->
<div class="pull-right">
<p class="title">用户名</p>
<p class="name">{{ user.userName }}</p>
</div>
</li>
<li class="list-group-item">
<div class="left"><i class="icon el-icon-user-solid"></i></div>
<!-- <div class="title-row"><svg-icon icon-class="user" /> 账号</div> -->
<div class="pull-right">
<p class="title">姓名</p>
<p class="name">{{ user.name }}</p>
</div>
</li>
<!-- <li class="list-group-item">
<div class="left"><i class="icon el-icon-phone"></i></div>
<div class="pull-right">
<p class="title">手机号码</p>
<p class="name">{{ user.phoneNumber }}</p>
</div>
</li>
<li class="list-group-item">
<div class="left"><i class="icon el-icon-platform-eleme" style="font-size:20px"></i></div>
<div class="pull-right">
<p class="title">用户邮箱</p>
<p class="name">{{ user.email }}</p>
</div>
</li> -->
<!-- <li class="list-group-item">
<svg-icon icon-class="tree" /> 所属部门
<div class="pull-right" v-if="user.dept"> / </div>
</li>
<li class="list-group-item">
<svg-icon icon-class="peoples" /> 所属角色
<div class="pull-right"></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="userinfo">
<userInfo :user="user" />
</el-tab-pane> -->
<el-tab-pane label="修改密码" name="resetPwd">
<resetPwd :user="user" />
</el-tab-pane>
</el-tabs>
</el-card>
</el-col>
</el-row>
</div>
</template>
<script>
import userInfo from "./userInfo";
import resetPwd from "./resetPwd";
import { loadLoginUserInfo } from "@/api/wms-auth";
export default {
name: "Profileuser",
components: { userInfo, resetPwd },
data() {
return {
user: {},
roleGroup: {},
postGroup: {},
activeTab: "resetPwd",
};
},
created() {
this.getUser();
},
methods: {
getUser() {
loadLoginUserInfo(this.$store.getters.currentUserInfo.id).then((response) => {
this.user = response;
});
},
},
};
</script>
<style lang="scss" scoped>
.list-group-striped{
list-style: none;
padding-left: 10px;
li{
display: flex;
padding-bottom: 15px;
background: #e9f6ff;
padding: 15px;
border-radius: 4px;
margin-bottom: 18px;
}
.icon{
font-size: 22px;
padding-right: 5px;
vertical-align: top;
color: #49a4f7;
width: 24px;
flex-shrink: 0;
padding-top: 8px;
}
.pull-right{
padding-left: 10px;
color: #999;
p{
margin: 0;
}
.title{
padding-bottom: 5px;
color: #333;
}
}
}
</style>

99
PC/InterFace.Dash/src/views/profileuser/resetPwd.vue

@ -1,99 +0,0 @@
<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="close">重置</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(() => {
//
});
}
});
},
close() {
this.$refs["form"].resetFields();
//this.$store.dispatch("tagsView/delView", this.$route);
//this.$router.push({ path: "/index" });
},
},
};
</script>

80
PC/InterFace.Dash/src/views/profileuser/userInfo.vue

@ -1,80 +0,0 @@
<template>
<el-form ref="form" :model="user" :rules="rules" label-width="80px">
<el-form-item label="用户姓名" prop="name">
<el-input v-model="user.name" />
</el-form-item>
<el-form-item label="手机号码" prop="phoneNumber">
<el-input v-model="user.phoneNumber" maxlength="11" />
</el-form-item>
<el-form-item label="邮箱" prop="email">
<el-input v-model="user.email" maxlength="50" />
</el-form-item>
<el-form-item>
<el-button type="primary" size="mini" @click="submit">保存</el-button>
<el-button type="danger" size="mini" @click="close">重置</el-button>
</el-form-item>
</el-form>
</template>
<script>
import { putLoginUserInfo } from "@/api/wms-auth";
export default {
props: {
user: {
type: Object,
},
},
data() {
return {
//
rules: {
nickName: [
{ required: true, message: "用户昵称不能为空", trigger: "blur" },
],
email: [
{ required: true, message: "邮箱地址不能为空", trigger: "blur" },
{
type: "email",
message: "'请输入正确的邮箱地址",
trigger: ["blur", "change"],
},
],
phonenumber: [
{ required: true, message: "手机号码不能为空", trigger: "blur" },
{
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
message: "请输入正确的手机号码",
trigger: "blur",
},
],
},
};
},
methods: {
submit() {
this.$refs["form"].validate((valid) => {
if (valid) {
putLoginUserInfo(this.user)
.then((response) => {
this.$notify({
title: "成功",
message: "修改成功",
type: "success",
duration: 2000,
});
})
.catch(() => {
//
});
}
});
},
close() {
this.$refs["form"].resetFields();
//this.$store.dispatch("tagsView/delView", this.$route);
//this.$router.push({ path: "/dashboard" });
},
},
};
</script>

262
PC/InterFace.Dash/src/views/systemManage/pcMenu.vue

@ -1,262 +0,0 @@
<template>
<div class="appMainPage" v-loading="loading">
<div class="main">
<tableTree
style="height:calc(100% - 100px)"
:treeData="tableData"
:treeColumn="treeColumn"
:needFormatData="true"
@freshTreeData="pageList"
:treeEditData="formData"
:treeEditRules="rules"
:treeEditForm="formList"
:treeEditSubmit="submitForm"
:treeEditBefore="editBefore"
@treeEditDelete="Delete"
@freshTreeEditForm="freshFormList"
:treeButtons="treeButtons"
></tableTree>
<!-- 示例 -->
<!--
:treeButtons="treeButtons"
:queryLeftButtons="queryLeftButtons"
:queryHeaderBtn="queryHeaderBtn"
:queryButtonsHandle="queryButtonsHandle"
-->
</div>
</div>
</template>
<script>
import { postCreateMenu, postUpdateMenu, postDeleteMenu, menuPermissions, getDetailedMenu } from "@/api/wms-auth";
import tableTree from "@/components/tableTree"
import { treeDefalutButton,queryDefalutButtons } from "@/utils/tableTree"
export default {
components: {
tableTree
},
name:"pcMenu",
data() {
return {
// table
treeButtons:[
...treeDefalutButton(function(row){
return !(String(row.sort).length < 5)
})
],
//
// queryHeaderBtn:['addFirst','fresh','search','reset','test'],
// queryLeftButtons:[
// ...queryDefalutButtons("left"),
// {
// type: 'warning',
// icon: 'el-icon-edit',
// label: '-left',
// name: "test",
// permission:"['Auth.Menu.Update']",
// size: 'mini'
// },
// ],
loading:false,
// /
formData:{
name:"",//
icon:"",//
code:"",//
parentCode:"",//
component:"",//
permission:"",//
route: "",//
sort:null,//
status:1,//
description: "",//
portal:0,//0:pc 1:pda
company: localStorage.getItem('company'),
},
// /
formList:[
{ type: "input", label: "菜单名称", prop: "name",placeholder:"例:按序收货"},
{ type: "input", label: "图标名称", prop: "icon",placeholder:"例:按序收货"},
{ type: "input", label: "编码", prop: "code",placeholder:"例:sortReceipt"},
{ type: "input", label: "父级编码", prop: "parentCode",placeholder:"例:sortReceipt"},
{ type: "input", label: "项目地址", prop: "component",placeholder:"例:basicData/ItemsManage/ItemBasic"},
{ type: "input", label: "权限", prop: "permission",placeholder:"例:base.info"},
{ type: "input", label: "路由", prop: "route",placeholder:"例:sortReceipt"},
{ type: "input", type:"number",valueType:Number,label: "排序", prop: "sort",},
{ type: "select", label: "状态", prop: "status", options: "enableOrStop"},
{ type: "input", label: "描述", prop: "description",},
],
//table
tableData: [],
// tree
treeColumn:[
{ label: "菜单名称", prop: "name",width:"250"},
{ label: "图标名称", prop: "icon",},
{ label: "编码", prop: "code",},
{ label: "父级编码", prop: "parentCode",},
{ label: "项目地址", prop: "component",},
{ label: "权限", prop: "permission",},
{ label: "路由", prop: "route",},
{ label: "排序", prop: "sort"},
{ type: "filter", label: "状态", prop: "status", filters: {"1":"启用","0":"停用"},align:'center',headerAlign:"center" },
{ label: "描述", prop: "description"},
],
rules: {
name: [ { required: true, trigger: "blur", message: "请输入菜单名称" }, ],
icon: [ { required: true, trigger: "blur", message: "请输入图标名称" }, ],
code: [ { required: true, trigger: "blur", message: "请输入编码" }, ],
permission: [ { required: true, trigger: "blur", message: "请输入权限" }, ],
route: [ { required: true, trigger: "blur", message: "请输入路由" }, ],
sort: [ { required: true, trigger: "change", message: "请输入排序" }, ],
status: [ { required: true, trigger: "change", message: "请选择状态" }, ],
},
}
},
mounted() {
this.pageList();
},
methods: {
//
// treeButtonsHandle(item,searchValue){
// return true //return true
// return false //return false
// },
// queryButtonsHandle(item,searchValue){
// return true //return true
// // return false //return false
// },
//table
pageList() {
this.tableData=[];
this.loading = true
let filters = []
filters.push({
logic: "And",
column: "portal",
action: "==",
value: "0"
})
const data = {
condition: {
filters: filters
},
Sorting: "",
SkipCount: 0,
MaxResultCount: 1000,
};
menuPermissions(data).then((res) => {
this.tableData = res.items
this.loading = false
}).catch(()=>{
this.loading = false
})
},
// disabled
freshFormList(item,row){
// /
if(item.name == "addFirst" || item.name == "add"){
if(item.name == "add"){
this.formData.parentCode = row.code
}
this.formList.forEach(column=>{
if(column.prop == 'parentCode'){
column.disabled = true
}
})
}
//
else if(item.name == "edit"){
if(Number(row.sort) > 100){
this.formList.forEach(column=>{
column.disabled = false
})
}else{
this.formList.forEach(column=>{
if(column.prop == 'parentCode'){
column.disabled = true
}
})
}
}
},
//
editBefore(row) {
if (row) {
return new Promise((resolve,reject) => {
getDetailedMenu(row.id).then(res=>{
// let _res = JSON.parse(JSON.stringify(res));
// Object.keys(this.formData).forEach(key=>{
// // if(_res[key] !== undefined)_res[key] = this.formData[key] ? this.formData[key] : _res[key]
// if(_res[key] !== undefined)_res[key] = this.formData[key] ? this.formData[key] : _res[key]
// })
resolve(res)
}).catch(()=>{
resolve()
})
})
}
},
//
Delete(row) {
if(row.children && row.children.length > 0){
this.$alert("此菜单存在子菜单,请先删除子菜单信息。", "提示", {
type: "warning",
});
return
}
this.$confirm("此操作将永久删除该菜单, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.loading = true
postDeleteMenu(row.id).then((res) => {
this.loading = false
this.$successMsg("删除成功!");
this.pageList();
}).catch((res) => {
this.loading = false
});
})
.catch(() => {});
},
//
submitForm(isEdit,data,val) {
data.portal = 0
return new Promise((resolve,reject) => {
if(!isEdit){
//
postCreateMenu(data)
.then((res) => {
this.$successMsg("创建成功!");
this.pageList();
resolve()
})
.catch((err) => {
resolve()
});
}else{
//
postUpdateMenu(data, data.id)
.then((res) => {
this.$successMsg("编辑成功!");
this.pageList();
resolve()
})
.catch((err) => {
resolve()
});
}
})
},
}
}
</script>
<style lang="scss" scoped>
.appMainPage {
.main {
height: 100%;
}
}
</style>

655
PC/InterFace.Dash/src/views/systemManage/pcUserManage.vue

@ -1,655 +0,0 @@
<template>
<div class="currentable" v-loading="savePerLoading">
<div class="header" />
<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"
v-permission="['AbpIdentity.Roles.Create']"
>创建角色</el-button
>
<el-button
type="success"
icon="el-icon-refresh"
@click.native.prevent="Createview"
>刷新</el-button
>
</div-->
<div class="query-box">
<el-input
v-model="input"
placeholder="搜索..."
@keyup.enter.native="filtrate"
/>
<el-button type="primary" @click.native.prevent="filtrate" >搜索</el-button>
<el-button type="danger" @click.native.prevent="reset" >重置</el-button>
</div>
</div>
<el-table
ref="multipleTable"
:data="tableData"
height="calc(100vh - 325px)"
style="width: 100%"
@sort-change="sortChange"
@row-click="handleRowClick"
@selection-change="handleSelectionChange"
>
<el-table-column
prop="userName"
label="用户名"
width="180"
align="center"
sortable="custom"
/>
<el-table-column
prop="email"
label="邮箱"
align="center"
:show-overflow-tooltip="true"
/>
<el-table-column
prop="phoneNumber"
label="电话号码"
sortable="custom"
align="center"
width="180"
>
</el-table-column>
<!-- <el-table-column prop="address" label="创建时间" />
<el-table-column prop="address" label="编辑" /> -->
</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 :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="savePerLoading"
:disabled="multipleSelection.length != 1"
icon="el-icon-check"
size="mini"
style="float: right; padding: 6px 9px"
type="primary"
@click="savePer"
>保存
</el-button>
</div>
<el-tree
ref="tree"
v-loading="treeLoading"
:default-checked-keys="checkedPermission"
:data="permissionsData"
:props="defaultProps"
show-checkbox
node-key="id"
class="permission-tree"
:default-expanded-keys="expandedKeys"
/>
</el-card>
</el-col>
</el-row>
</div>
</template>
<script>
import {
postCreate,
postUpdate,
postDelete,
getPageList,
menuPermissions,
UserPermissions,
SetUserPermissions,
} from "@/api/wms-auth";
import permission from "@/utils/permission/index";
export default {
name: 'pcUserManage',
directives: { permission },
data() {
//
return {
URL: 'auth/user-menu/web',//todo-new:使urlOption.js
// name
name:'',
// id
expandedKeys:[],
//
dialogVisible: false,
//
isEdit: false,
//title
formTitle: "",
//
input: "",
//
total: 0,
//
queryInfo: {
//
currentPage: 1,
//
pagesize: 20,
Sorting: "",
},
// Thecurrent: '',
//
//
// value1: '',
//
// roleList: [],
//ID
usersId: "",
//
concurrencyStamp: "",
//
form: {
name: "",
isDefault: true,
isPublic: true,
extraProperties: {
Describe: "",
},
},
//
savePerLoading: false,
//
treeLoading: false,
//
checkedPermission: [],
//
permissionsData: [],
//ID
userId:"",
defaultProps: {
children: "children",
label: "name",
},
//
params: {
providerName: "R",
providerKey: "",
},
//
multipleSelection: [],
//table
tableData: [],
rules: {
name: [
{ required: true, trigger: "blur", message: "请输入姓名" },
{
min: 1,
max: 23,
message: "长度在 1 到 23 个字符",
trigger: "blur",
},
],
},
};
},
// watch:{
// value1:function(newVal,oldVal){
// this.pageList()
// }
// },
created() {
// usersroles().then(res => {
//
// this.roleList = res.data.items
// })
},
mounted() {
this.pageList();
},
methods: {
//sort () sort
sortData(sort){
return function(a,b){
const val1 = a[sort];
const val2 = b[sort];
return val1 - val2;
}
},
//
initTreeData(list,code = ""){
const children = []
// list,.parentCode==code,children
list.forEach(item => {
if (item['parentCode'] == code) {
// children.push(item)
children.push(
{
id: item.id,
displayName: item.permission,
name: item.name,
parentCode: item.parentCode,
code: item.code,
sort: item.sort,
company: item.company,
children: []
}
)
//
children.find(findItem => findItem.id == item.id).children=this.initTreeData(list,item['code']).sort(this.sortData('sort'))
this.rolesAll.forEach(itemRes => {
if (item.code == itemRes.menuCode) {
this.checkedPermission.push(item.id);
}
})
}
})
return children
},
//table
pageList() {
const data = {
Filter: this.input,
Sorting: this.queryInfo.Sorting,
SkipCount: (this.queryInfo.currentPage - 1) * this.queryInfo.pagesize,
MaxResultCount: this.queryInfo.pagesize,
};
getPageList(data).then((res) => {
const data = res;
this.total = data.totalCount;
this.tableData = data.items;
});
},
//
sortChange(data) {
const { prop, order } = data;
if (!prop || !order) {
this.queryInfo.Sorting = "";
this.handleFilter();
return;
}
this.queryInfo.Sorting = prop + " " + order;
// alert(this.listQuery.Sorting)
this.handleFilter();
},
//
handleFilter() {
this.queryInfo.currentPage = 1;
this.pageList();
},
//
filtrate() {
this.queryInfo.currentPage = 1;
this.pageList();
},
//
reset() {
this.input = "";
this.queryInfo.currentPage = 1;
this.queryInfo.Sorting = "";
this.permissionsData = []
this.treeLoading = false
this.pageList();
},
//
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.form.extraProperties.Describe = "";
this.$refs.multipleTable.clearSelection();
},
//
handleCreate() {
this.formTitle = "创建角色";
this.dialogVisible = true;
this.isEdit = false;
},
//
Createview() {
this.input = "";
this.queryInfo.currentPage = 1;
this.queryInfo.Sorting = "";
this.pageList();
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;
this.form.extraProperties.Describe = row.extraProperties.Describe;
}
},
//
Delete(row) {
this.$confirm("此操作将永久删除该角色, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
if (this.tableData.length == 1) {
this.queryInfo.currentPage = this.queryInfo.currentPage - 1;
}
postDelete(row.id).then((res) => {
this.$successMsg("删除成功!");
this.pageList();
})
})
.catch(() => {});
},
//
submitForm() {
this.$refs.form.validate((valid) => {
//
if (valid && !this.isEdit) {
postCreate(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;
postUpdate(data, this.usersId)
.then((res) => {
this.$successMsg("编辑成功!");
this.pageList();
// this.Thecurrent = ''
this.resetform();
})
.catch((err) => {
// this.Thecurrent = ''
this.resetform();
});
} else {
this.$errorMsg("请按照提示继续输入!");
return false;
}
});
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
//
async savePer() {
this.savePerLoading = true;
let data = await this.PromiseData()
SetUserPermissions(data,{userId:this.userId}, this.URL + '/by-user')
.then((response) => {
this.$notify({
title: "成功",
message: "更新成功",
type: "success",
duration: 2000,
});
this.savePerLoading = false;
})
.catch(err => {
this.savePerLoading = false;
})
},
//
PromiseData(){
return new Promise((resolve)=>{
let params = [];
let checkedKeys = this.$refs.tree.getCheckedKeys();
// console.log("",checkedKeys);
console.log(this.permissionsData);
this.permissionsData.forEach((element) => {
element.children.forEach((item) => {
item.children.forEach(itemChildren => {
// console.log("",itemChildren.code);
if(checkedKeys.indexOf(itemChildren.id) != -1){
console.log("itemChildren.company",itemChildren.company);
let perm = {};
perm.userId = this.userId
perm.menuCode = itemChildren.code
perm.company = itemChildren.company
perm.portal = '0'
params.push(perm)
}
})
});
});
resolve(params)
})
},
//table
handleRowClick(row, column, event) {
let that = this
this.name = row.userName
this.$refs.multipleTable.clearSelection();
this.$refs.multipleTable.toggleRowSelection(row);
this.treeLoading = true;
UserPermissions({ userId: row.id }, this.URL + '/by-user')
.then((response) => {
this.rolesAll = []
this.permissionsData = []
this.checkedPermission = []
this.userId = row.id
this.rolesAll = response
console.log(response)
console.log(this.rolesAll)
let filters = []
filters.push({
logic: "And",
column: "portal",
action: "==",
value: "0"
})
const data = {
condition: {
filters: filters
},
Sorting: "",
SkipCount: 0,
MaxResultCount: 1000,
};
menuPermissions(data).then((res) => {
let rs = that.initTreeData(res.items,'').sort(that.sortData('sort'))
rs.forEach(item => {
that.permissionsData.push(item);
})
that.$nextTick(() => {
that.$refs.tree.setCheckedKeys(that.checkedPermission)
})
// console.log('',that.permissionsData)
// console.log('',that.checkedPermission)
// console.log('',that.rolesAll)
that.treeLoading = false;
}).catch((err)=>{
that.treeLoading = false;
console.log(err)
})
})
.catch(err => {
that.treeLoading = false;
})
},
setTree(data, userData) {
let root = {};
root.id = "1";
root.name = "PDA权限菜单";
root.children = [];
let childrenId = 10
this.expandedKeys.push(root.id)
data.forEach((element) => {
// groupName
let isGroup = true
root.children.forEach(item => {
if (item.name == element.groupName) {
isGroup = false
let childrenChildren = {}
childrenChildren.id = element.code;
childrenChildren.name = element.name
childrenChildren.company = element.company
childrenChildren.menuCode = element.code;
this.expandedKeys.push(element.code)
item.children.push(childrenChildren)
}
})
if (isGroup) {
let children = {};
children.name = element.groupName
children.id = childrenId
childrenId += 1
children.children = [];
let childrenChildren = {}
childrenChildren.id = element.code;
childrenChildren.name = element.name
childrenChildren.company = element.company
childrenChildren.menuCode = element.code;
children.children.push(childrenChildren)
root.children.push(children);
// console.log("",userData);
// console.log("ID",element.id);
}
// let children = {};
// children.id = element.code;
// children.name = element.name
// children.company = element.company
// children.menuCode = element.code;
// children.children = [];
// root.children.push(children);
// console.log("",userData);
// console.log("ID",element.id);
if (userData.indexOf(element.code) != -1) {
// console.log('NAME',element.name);
this.checkedPermission.push(element.code);
}
});
this.permissionsData.push(root);
// console.log("",data[0]);
},
},
};
</script>
<style lang="scss" scoped>
.currentable {
.header {
background-color: #fff;
height: 40px;
}
.main {
padding: 0 40px;
background-color: #f2f2f2;
.table-active {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
padding-bottom: 20px;
.bttton-box {
padding-top: 20px;
display: flex;
}
.query-box {
padding-top: 20px;
display: flex;
.el-input {
margin: 0 5px;
}
.el-select {
::v-deep .el-input {
width: 100px;
}
}
}
}
}
.el-table__body-wrapper {
tbody {
span {
cursor: pointer;
&:hover {
color: #409eff;
}
}
}
}
.Footer {
padding: 40px 40px;
background-color: #f2f2f2;
display: flex;
justify-content: flex-end;
::v-deep button {
background-color: #fff;
}
::v-deep .number {
background-color: #fff;
}
}
::v-deep .el-dialog {
.el-dialog__header {
button {
display: none;
}
}
}
.permission-tree{
padding: 20px;
height: 690px;
overflow-y: auto;
}
}
</style>

705
PC/InterFace.Dash/src/views/systemManage/roleManage.vue

@ -1,705 +0,0 @@
<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
border=""
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"
width="180"
align="left"
/>
<el-table-column
prop="extraProperties.Description"
label="角色描述"
align="left"
:show-overflow-tooltip="true"
/>
<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-column prop="address" label="创建时间" />
<el-table-column prop="address" label="编辑" /> -->
</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 :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="savePerLoading"
:disabled="multipleSelection.length != 1"
icon="el-icon-check"
size="mini"
style="float: right; padding: 6px 9px"
type="primary"
@click="savePer"
>保存
</el-button>
</div>
<el-tree
ref="tree"
v-loading="treeLoading"
:check-strictly="false"
:data="permissionsData"
:props="defaultProps"
show-checkbox
node-key="id"
class="permission-tree"
/>
</el-card>
</el-col>
</el-row>
<el-dialog
:title="formTitle"
:visible.sync="dialogVisible"
width="600px"
:close-on-click-modal="false"
>
<el-form
ref="form"
:model="form"
label-width="70px"
:rules="rules"
size="small"
:inline="true"
>
<el-form-item label="名称" prop="name">
<el-input v-model="form.name" style="width: 380px" maxlength="23" />
</el-form-item>
<el-form-item label="描述">
<el-input
type="textarea"
:rows="2"
placeholder="请输入描述信息"
style="width: 380px"
v-model="form.extraProperties.Description"
>
</el-input>
</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 {
postCreateRoles,
postUpdateRoles,
postDeleteRoles,
getPageListRoles,
getpermissionsRoles,
putpermissionsRoles,
menuPermissions,
saveOrUpdateDescribe
} from "@/api/wms-auth";
import permission from "@/utils/permission/index";
import searchNormal from "@/components/searchNormal/index.vue"
export default {
directives: { permission },
components:{
searchNormal
},
name:"RoleManage",
data() {
//
return {
URL: 'identity/roles',//todo-new:使urlOption.js
//
name: '',
//
rolesAll: [],
//
dialogVisible: false,
//
isEdit: false,
//title
formTitle: "",
//
total: 0,
//
queryInfo: {
//
currentPage: 1,
//
pagesize: 20,
Sorting: "",
},
// Thecurrent: '',
//
//
// value1: '',
//
// roleList: [],
//ID
usersId: "",
//
concurrencyStamp: "",
//
form: {
name: "",
isDefault: true,
isPublic: true,
extraProperties: {
Description: "",
},
},
//
savePerLoading: false,
//
treeLoading: false,
//
checkedPermission: [],
//
permissionsData: [],
defaultProps: {
children: "children",
label: "name",
},
//
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: {
//sort () sort
sortData(sort){
return function(a,b){
const val1 = a[sort];
const val2 = b[sort];
return val1 - val2;
}
},
//
initTreeData(list,code = ""){
const children = []
// list,.parentCode==code,children
list.forEach(item => {
if (item['parentCode'] == code) {
// children.push(item)
children.push(
{
id: item.id,
displayName: item.permission,
name: item.name,
parentCode: item.parentCode,
code: item.code,
sort: item.sort,
children: []
}
)
//
children.find(findItem => findItem.id == item.id).children=this.initTreeData(list,item['code']).sort(this.sortData('sort'))
this.rolesAll.forEach(itemRes => {
if (item.permission == itemRes.name) {
if (itemRes.isGranted) {
this.checkedPermission.push(item.id);
}
}
})
}
})
return children
},
//table
pageList(val) {
const data = {
Filter: val || '',
Sorting: this.queryInfo.Sorting,
SkipCount: (this.queryInfo.currentPage - 1) * this.queryInfo.pagesize,
MaxResultCount: this.queryInfo.pagesize,
};
getPageListRoles(data).then((res) => {
const data = res;
this.total = data.totalCount;
this.tableData = data.items;
});
},
//
sortChange(data) {
const { prop, order } = data;
if (!prop || !order) {
this.queryInfo.Sorting = "";
this.handleFilter();
return;
}
this.queryInfo.Sorting = prop + " " + order;
// alert(this.listQuery.Sorting)
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.form.extraProperties.Description = "";
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;
this.form.extraProperties.Description = row.extraProperties.Description;
}
},
//
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();
});
})
.catch(() => {});
},
//
submitForm() {
this.$refs.form.validate((valid) => {
//
if (valid && !this.isEdit) {
postCreateRoles(this.form)
.then((res) => {
this.saveOrUpdateDescribe(res.id)
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.saveOrUpdateDescribe(this.usersId)
this.pageList();
this.resetform();
})
.catch((err) => {
this.resetform();
});
} else {
this.$errorMsg("请按照提示继续输入!");
return false;
}
});
},
//
saveOrUpdateDescribe (id) {
saveOrUpdateDescribe({description:this.form.extraProperties.Description}, id).then(res => {
// console.log(res)
}).catch(err => {
console.log(err)
})
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
//
savePer() {
this.savePerLoading = true;
let params = {};
let checkedKeys = this.$refs.tree.getCheckedKeys();
params.permissions = [];
this.permissionsData.forEach((element) => {
element.children.forEach((item) => {
let perm = {};
perm.name = item.displayName;
perm.isGranted = false;
if (checkedKeys.indexOf(item.id) > -1) {
perm.isGranted = true;
}
//
this.getZSG(item.displayName, params, perm.isGranted)
params.permissions.push(perm);
item.children.forEach((i) => {
let perm = {};
perm.name = i.displayName;
perm.isGranted = false;
if (checkedKeys.indexOf(i.id) > -1) {
perm.isGranted = true;
}
//
this.getZSG(i.displayName, params, perm.isGranted)
params.permissions.push(perm);
});
});
});
params.permissions.forEach((item,index) => {
//
if (item.name == 'skip') {
params.permissions.splice(index, 1)
}
// |
if (item.name == 'AbpIdentity.Users' ) {
if (item.isGranted) {
params.permissions.push({
isGranted: true,
name: 'AbpIdentity.Users.Create'
},{
isGranted: true,
name: 'AbpIdentity.Users.Update'
},{
isGranted: true,
name: 'AbpIdentity.Users.Delete'
},{
isGranted: true,
name: 'AbpIdentity.Users.ManagePermissions'
})
} else {
params.permissions.push({
isGranted: false,
name: 'AbpIdentity.Users.Create'
},{
isGranted: false,
name: 'AbpIdentity.Users.Update'
},{
isGranted: false,
name: 'AbpIdentity.Users.Delete'
},{
isGranted: false,
name: 'AbpIdentity.Users.ManagePermissions'
})
}
}
if (item.name == 'AbpIdentity.Roles' ) {
if (item.isGranted) {
params.permissions.push({
isGranted: true,
name: 'AbpIdentity.Roles.Create'
},{
isGranted: true,
name: 'AbpIdentity.Roles.Update'
},{
isGranted: true,
name: 'AbpIdentity.Roles.Delete'
})
} else {
params.permissions.push({
isGranted: false,
name: 'AbpIdentity.Roles.Create'
},{
isGranted: false,
name: 'AbpIdentity.Roles.Update'
},{
isGranted: false,
name: 'AbpIdentity.Roles.Delete'
})
}
}
})
// *************************
params.permissions.filter((item) => {
if (item.name == 'AbpIdentity.Roles.ManagePermissions' || item.name == 'Auth.UserMenu') {
item.isGranted = true
}
})
putpermissionsRoles(
"/permission-management/permissions?providerName=R&providerKey=" +
this.multipleSelection[0].name,
params
).then((response) => {
this.$notify({
title: "成功",
message: "更新成功",
type: "success",
duration: 2000,
});
this.savePerLoading = false;
}).catch(err=>{
this.savePerLoading = false;
});
},
//
getZSG(name,params,isGranted) {
if (name !== 'skip') {
this.rolesAll.forEach(item => {
if (item.parentName == name ) {
let perm = {}
perm.name = item.name
perm.isGranted = isGranted
params.permissions.push(perm)
}
})
}
},
//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.rolesAll = []
this.permissionsData = [];
this.checkedPermission = [];
//
res.groups.forEach(itemRes => {
itemRes.permissions.forEach(item => {
// if (item.displayName !== '' && item.displayName !== '' && item.displayName !== '' && item.displayName !== '') {
this.rolesAll.push(item)
// }
})
})
let filters = []
filters.push({
logic: "And",
column: "portal",
action: "==",
value: "0"
})
const data = {
condition: {
filters: filters
},
Sorting: "",
SkipCount: 0,
MaxResultCount: 1000,
};
menuPermissions(data).then((res) => {
let rs = that.initTreeData(res.items,'').sort(that.sortData('sort'))
rs.forEach(item => {
that.permissionsData.push(item);
})
that.$nextTick(() => {
that.$refs.tree.setCheckedKeys(that.checkedPermission)
})
// console.log('',that.permissionsData)
// console.log('',that.checkedPermission)
// console.log('',that.rolesAll)
that.treeLoading = false;
}).catch((err)=>{
that.treeLoading = false;
console.log(err)
})
});
},
},
};
</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>

818
PC/InterFace.Dash/src/views/systemManage/userManage.vue

@ -1,818 +0,0 @@
<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
>
<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="email"
label="邮箱"
align="center"
:show-overflow-tooltip="true"
/>
<el-table-column
prop="phoneNumber"
label="电话号码"
sortable="custom"
align="center"
width="180"
>
</el-table-column> -->
<el-table-column
prop="extraProperties.IsActive"
label="是否启用"
sortable="custom"
align="center"
width="180"
>
<template slot-scope="scope">
<span>{{ scope.row['extraProperties']['IsActive'] | trigger('whetherOrNot', "label") }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="230">
<template slot-scope="scope">
<!-- icon="el-icon-edit" -->
<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="primary"
size="mini"
icon="el-icon-circle-check"
@click="Delete(scope.row)"
v-permission="['AbpIdentity.Users.Update']"
v-if="scope.row.name == 'admin' ? false : true && !scope.row.lockoutEnabled"
>启用</el-button
>
<el-button
type="danger"
size="mini"
icon="el-icon-circle-close"
@click="Delete(scope.row)"
v-permission="['AbpIdentity.Users.Update']"
v-if="scope.row.name == 'admin' ? false : true && scope.row.lockoutEnabled"
>禁用</el-button
> -->
<!-- <el-tooltip
content="重置用户密码"
placement="bottom"
effect="light"
> -->
<!-- icon="el-icon-refresh-right" -->
<el-button
type="text"
@click="resetPassword(scope.row)"
v-if="scope.row.name == 'admin' ? false : true"
>重置密码</el-button>
<!-- </el-tooltip> -->
<!-- icon="el-icon-delete" -->
<el-button
type="text"
@click="deleteUser(scope.row)"
v-if="scope.row.name == 'admin' ? false : true"
style="color:red"
>删除用户</el-button>
</template>
</el-table-column>
<!-- <el-table-column prop="address" label="创建时间" />
<el-table-column prop="address" label="编辑" /> -->
</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="600px"
:close-on-click-modal="false"
>
<el-form
ref="form"
:model="form"
label-width="70px"
:rules="rules"
size="small"
:inline="true"
>
<el-form-item label="用户名" prop="userName">
<el-input
v-model="form.userName"
style="width: 184px"
maxlength="20"
/>
</el-form-item>
<!-- <el-form-item label="电话" prop="phoneNumber">
<el-input
v-model="form.phoneNumber"
style="width: 184px"
maxlength="11"
/>
</el-form-item> -->
<el-form-item label="姓名" prop="name">
<el-input v-model="form.name" style="width: 184px" maxlength="20" />
</el-form-item>
<!-- <el-form-item label="邮箱" prop="email">
<el-input v-model="form.email" style="width: 184px" />
</el-form-item> -->
<el-form-item label="角色" prop="roleNames">
<el-select
v-model="form.roleNames"
multiple
style="width: 188px"
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="extraProperties.IsActive">
<el-select
v-model="form.extraProperties.IsActive"
style="width: 188px"
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"
style="width: 184px"
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-item label="部门" prop="extraProperties.DepartmentCode">
<el-select
v-model="form.extraProperties.DepartmentCode"
style="width: 188px"
placeholder="请选择"
>
<el-option
v-for="item in departmentOptions"
:key="item.id"
:label="item.name"
:value="item.code"
></el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="描述">
<el-input
type="textarea"
:rows="2"
placeholder="请输入描述信息"
style="width: 450px"
v-model="form.extraProperties.IsActive"
>
</el-input>
</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 {
postCreate,
postUpdate,
postDelete,
getPageList,
getusersID,
usersroles,
putpassword,
departmentList
} from "@/api/wms-auth";
import permission from "@/utils/permission/index";
import searchNormal from "@/components/searchNormal/index.vue"
export default {
directives: { permission },
components:{
searchNormal
},
name:"UserManage",
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: "",
},
// Thecurrent: '',
//
//
// value1: '',
//
options: [],
//
departmentOptions: [],
//ID
usersId: "",
//
concurrencyStamp: "",
//
form: {
userName: "",
phoneNumber: "",
name: "",
email: "",
roleNames: [],
password: "",
surname: "",
lockoutEnabled: true,
extraProperties: {
DepartmentCode: '',
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", validator: validpassword },
{ required: true, trigger: "blur", message: "请输入密码" },
{
min: 6,
max: 16,
message: "长度在 6 到 16 个字符",
trigger: "blur",
},
],
roleNames: [
{ required: true, message: "请选择角色", trigger: "change" },
],
},
};
},
// watch:{
// value1:function(newVal,oldVal){
// this.pageList()
// }
// },
created() {
//
usersroles().then((res) => {
this.options = res.items;
});
//
departmentList({},'auth/department').then(res => {
this.departmentOptions = res.items;
})
},
mounted() {
this.pageList();
},
methods: {
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,
};
getPageList(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;
// alert(this.listQuery.Sorting)
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.extraProperties.IsActive = "";
this.form.extraProperties.DepartmentCode = "";
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.extraProperties.IsActive = row.extraProperties.IsActive;
this.form.extraProperties.DepartmentCode = row.extraProperties.DepartmentCode;
departmentList({},'auth/department').then(res => {
this.departmentOptions = res.items
})
usersroles().then((res) => {
this.options = res.items;
});
this.isEdit = true;
this.dialogVisible = true;
}
// else {
// if (this.multipleSelection.length != 1) {
// this.$message({
// message: "",
// type: "warning",
// });
// return;
// } else {
// this.formTitle = ''
// this.dialogVisible = true
// this.isEdit = true
// const row = this.multipleSelection[0]
// 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.concurrencyStamp = row.concurrencyStamp
// }
// }
},
//
// Delete(row) {
// this.$confirm(", ?", "", {
// confirmButtonText: "",
// cancelButtonText: "",
// type: "warning",
// })
// .then(() => {
// if (this.tableData.length == 1) {
// this.queryInfo.currentPage = this.queryInfo.currentPage - 1;
// }
// postDelete(row.id).then((res) => {
// this.$successMsg("");
// this.pageList();
// });
// })
// .catch(() => {});
// },
//
submitForm() {
this.$refs.form.validate((valid) => {
//
if (valid && !this.isEdit) {
this.form.surname = this.form.name;
postCreate(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;
postUpdate(data, this.usersId)
.then((res) => {
this.$successMsg("编辑成功!");
// this.queryInfo.currentPage = 1
this.pageList();
// this.Thecurrent = ''
this.resetform();
})
.catch((err) => {
// this.Thecurrent = ''
this.resetform();
});
} else {
this.$errorMsg("请按照提示继续输入!");
return false;
}
});
},
//
resetPassword (row) {
this.$confirm("是否修改" + row.userName + "密码?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
putpassword(row.id).then((response) => {
this.$notify({
title: "成功",
message: "重置成功, 密码是: 000000",
type: "success",
duration: 2000,
});
});
})
.catch(() => {
this.$message({
type: "info",
message: "已取消修改",
});
});
},
//
deleteUser(row){
this.$confirm("您确认删除 " + row.userName + " 用户吗?", "提示", {
confirmButtonText: "确认删除用户",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.loading = true
postDelete(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 .number {
// 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>

661
PC/InterFace.Dash/src/views/systemManage/userWorkGroup.vue

@ -1,661 +0,0 @@
<template>
<div class="appMainPage" v-loading="pageLoading">
<div class="pageCenter">
<div class="leftInfo">
<div class="main">
<div class="table-active">
<!-- <div class="bttton-box">
<el-button
type="primary"
icon="el-icon-plus"
@click="handleCreate"
v-permission="['AbpIdentity.Roles.Create']"
>创建角色</el-button
>
<el-button
type="success"
icon="el-icon-refresh"
@click.native.prevent="Createview"
>刷新</el-button
>
</div-->
<div class="query-box">
<!-- 搜索 -->
<searchNormal
ref="normalSearch_UserWorkGroup"
@searchNormalClick="filtrate"
@searchNormalClear="filtrate"
></searchNormal>
<el-button
style="margin-left:10px"
type="danger"
@click.native.prevent="reset"
size="mini"
>重置</el-button>
</div>
</div>
<el-table
border=""
ref="multipleTable"
:data="tableData"
height="calc(100vh - 265px)"
style="width: 100%"
@sort-change="sortChange"
@row-click="handleRowClick"
@selection-change="handleSelectionChange"
>
<el-table-column
type="selection"
width="55"
:selectable="selectEvent"
align="center"
/>
<el-table-column
prop="userName"
label="用户名"
width="180"
align="left"
sortable="custom"
/>
<el-table-column
prop="email"
label="邮箱"
align="left"
:show-overflow-tooltip="true"
/>
<el-table-column
prop="phoneNumber"
label="电话号码"
sortable="custom"
align="left"
width="180"
>
</el-table-column>
<!-- <el-table-column prop="address" label="创建时间" />
<el-table-column prop="address" label="编辑" /> -->
</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>
</div>
<div v-permission="['AbpIdentity.Roles.Update']" class="rightInfo">
<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">工作组</span>
</el-tooltip>
<el-button
:loading="savePerLoading"
:disabled="multipleSelection.length != 1"
icon="el-icon-check"
size="mini"
style="float: right; padding: 6px 9px"
type="primary"
@click="savePer"
>保存
</el-button>
</div>
<el-tree
ref="tree"
v-loading="treeLoading"
:default-checked-keys="checkedPermission"
:check-strictly="false"
:data="permissionsData"
:props="defaultProps"
show-checkbox
node-key="id"
class="permission-tree"
:default-expand-all='true'
/>
</el-card>
</div>
</div>
</div>
</template>
<script>
import {
postCreate,
postUpdate,
postDelete,
getPageList,
userWorkgroupPermissions,
SetUserWorkgroupPermissions,
} from "@/api/wms-auth";
import {getPageList as workgroupGetList } from "@/api/wms-api"
import permission from "@/utils/permission/index";
import searchNormal from "@/components/searchNormal/index.vue"
export default {
name:"UserWorkGroup",
directives: { permission },
components:{
searchNormal
},
data() {
//
return {
pageLoading:false,
//
dialogVisible: false,
//
isEdit: false,
//title
formTitle: "",
//
total: 0,
//
queryInfo: {
//
currentPage: 1,
//
pagesize: 20,
Sorting: "",
},
// Thecurrent: '',
//
//
// value1: '',
//
// roleList: [],
//ID
usersId: "",
//
concurrencyStamp: "",
//
form: {
name: "",
isDefault: true,
isPublic: true,
extraProperties: {
Describe: "",
},
},
//
savePerLoading: false,
//
treeLoading: false,
//
checkedPermission: [],
//
permissionsData: [],
//ID
userId:"",
defaultProps: {
children: "children",
label: "name",
},
//
params: {
providerName: "R",
providerKey: "",
},
//
multipleSelection: [],
//table
tableData: [],
rules: {
name: [
{ required: true, trigger: "blur", message: "请输入姓名" },
{
min: 1,
max: 23,
message: "长度在 1 到 23 个字符",
trigger: "blur",
},
],
},
};
},
// watch:{
// value1:function(newVal,oldVal){
// this.pageList()
// }
// },
created() {
// usersroles().then(res => {
//
// this.roleList = res.data.items
// })
},
mounted() {
this.pageList();
},
methods: {
//table
pageList(val) {
this.pageLoading = true
const data = {
condition: {
filters: []
},
Filter: val || '',
Sorting: this.queryInfo.Sorting,
SkipCount: (this.queryInfo.currentPage - 1) * this.queryInfo.pagesize,
MaxResultCount: this.queryInfo.pagesize,
};
getPageList(data).then((res) => {
this.pageLoading = false
const data = res;
this.total = data.totalCount;
this.tableData = data.items;
}).catch(err => {
this.pageLoading = false
})
},
//
sortChange(data) {
const { prop, order } = data;
if (!prop || !order) {
this.queryInfo.Sorting = "";
this.handleFilter();
return;
}
this.queryInfo.Sorting = prop + " " + order;
// alert(this.listQuery.Sorting)
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();
},
//
reset() {
this.queryInfo.currentPage = 1;
this.queryInfo.Sorting = "";
this.permissionsData = []
this.$refs.normalSearch_UserWorkGroup.searchNormalClear()//
},
//
resetform() {
this.$refs.form.resetFields();
this.dialogVisible = false;
this.form.name = "";
this.form.extraProperties.Describe = "";
this.$refs.multipleTable.clearSelection();
},
//
handleCreate() {
this.formTitle = "创建角色";
this.dialogVisible = true;
this.isEdit = false;
},
//
Createview() {
this.queryInfo.currentPage = 1;
this.queryInfo.Sorting = "";
this.$refs.normalSearch_UserWorkGroup.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;
this.form.extraProperties.Describe = row.extraProperties.Describe;
}
// else {
// if (this.multipleSelection.length != 1) {
// this.$message({
// message: "",
// type: "warning",
// });
// return;
// } else {
// this.formTitle = ''
// this.dialogVisible = true
// this.isEdit = true
// const row = this.multipleSelection[0]
// 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;
}
this.pageLoading = true
postDelete(row.id).then((res) => {
this.pageLoading = false
this.$successMsg("删除成功!");
this.pageList();
}).catch(() => {
this.pageLoading = false
});
})
.catch(() => {});
},
//
submitForm() {
this.$refs.form.validate((valid) => {
//
if (valid && !this.isEdit) {
this.pageLoading = true
postCreate(this.form)
.then((res) => {
this.resetform();
this.pageLoading = false
this.$successMsg("创建成功!");
this.queryInfo.currentPage = 1;
this.pageList();
})
.catch((err) => {
this.pageLoading = false
this.resetform();
});
} else if (valid && this.isEdit) {
//
const data = JSON.parse(JSON.stringify(this.form));
data.concurrencyStamp = this.concurrencyStamp;
this.pageLoading = true
postUpdate(data, this.usersId)
.then((res) => {
this.pageLoading = false
this.$successMsg("编辑成功!");
this.pageList();
// this.Thecurrent = ''
this.resetform();
})
.catch((err) => {
this.pageLoading = false
// this.Thecurrent = ''
this.resetform();
});
} else {
this.$errorMsg("请按照提示继续输入!");
return false;
}
});
},
//
selectEvent(row, index) {
// if (row.name == "admin") {
// return false;
// } else {
return true;
// }
},
handleSelectionChange(val) {
this.multipleSelection = val;
this.treeLoading = true;
if (val.length == 1) {
// this.params.providerKey = val[0].name;
workgroupGetList({
condition: {
filters: []
},
Sorting: "",
SkipCount: 0,
MaxResultCount: 1000,},'basedata/work-group').then((res) => {
userWorkgroupPermissions({ userGuid: val[0].id })
.then((response) => {
// const objKey = Object.keys(response)
let objKey = [];
for (let i = 0; i < response.length; i++) {
objKey.push(response[i].workGroupCode);
}
this.permissionsData = [];
this.checkedPermission = [];
this.userId = val[0].id
this.setTree(res.items, objKey);
this.treeLoading = false;
})
.catch((err) => {
this.treeLoading = false;
});
})
.catch((err) => {
this.treeLoading = false;
});
} else {
this.treeLoading = false;
this.permissionsData = [];
this.checkedPermission = [];
if (val.length > 1) {
this.$notify({
title: "提示",
message: "不接受多行",
type: "warning",
duration: 2000,
});
}
}
},
//
async savePer() {
this.savePerLoading = true;
let data = await this.PromiseData()
SetUserWorkgroupPermissions(data,{userid:this.userId}).then((response) => {
this.$notify({
title: "成功",
message: "更新成功",
type: "success",
duration: 2000,
});
this.savePerLoading = false;
}).catch((err) => {
this.savePerLoading = false;
});
},
//
PromiseData(){
return new Promise((resolve)=>{
let params = [];
let checkedKeys = this.$refs.tree.getCheckedKeys();
// console.log("",checkedKeys);
this.permissionsData.forEach((element) => {
element.children.forEach((item) => {
// console.log("",item.code);
if(checkedKeys.indexOf(item.id) != -1){
// console.log("",item);
let perm = {};
perm.userId = this.userId
perm.remark = item.remark
perm.workGroupCode = item.id
perm.company = item.company
params.push(perm)
}
});
});
resolve(params)
})
},
//
checkNode(data, state) {
if (!data.parentId) {
if (state.checkedKeys.indexOf(data.id) === -1) {
data.children.forEach((element) => {
this.$refs.tree.setChecked(element.id, false);
});
}
} else {
if (state.checkedKeys.indexOf(data.id) > -1) {
this.$refs.tree.setChecked(data.parentId, true);
}
}
},
//table
handleRowClick(row, column, event) {
// console.log("", row);
if (
this.multipleSelection.length == 1 &&
this.multipleSelection[0].id == row.id
) {
this.$refs.multipleTable.clearSelection();
return;
}
// 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;
// getpermissions(this.params).then(res => {
// this.permissionsData = [];
// this.checkedPermission = [];
// this.setTree(res.data.groups);
// this.treeLoading = false;
// })
},
setTree(data, userData) {
let root = {};
root.id = "1";
root.name = "工作组菜单";
root.children = [];
data.forEach((element) => {
let children = {};
children.id = element.code;
children.name = element.name
children.userId = element.id
children.company = element.company
children.remark =element.remark
children.children = [];
root.children.push(children);
// console.log("",userData);
// console.log("ID",element.id);
if (userData.indexOf(element.code) != -1) {
// console.log('NAME',element.code);
this.checkedPermission.push(element.code);
}
});
this.permissionsData.push(root);
// console.log("",this.permissionsData);
},
},
};
</script>
<style lang="scss" scoped>
.appMainPage {
padding:20px;
.pageCenter{
display: flex;
height: 100%;
}
.main {
.table-active {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
padding:5px 0 15px 0;
.bttton-box {
display: flex;
}
.query-box {
display: flex;
}
}
}
.leftInfo{
width: 65%;
}
.rightInfo{
width: 35%;
padding: 0;
margin-left: 25px;
.el-card{
height: 100%;
}
}
.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: calc(100vh - 240px);
overflow-y: auto;
}
}
</style>
Loading…
Cancel
Save