haiwei-module-admin 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/package.json +54 -0
  2. package/src/api/components/account.js +58 -0
  3. package/src/api/components/auditInfo.js +30 -0
  4. package/src/api/components/auth.js +47 -0
  5. package/src/api/components/cache.js +16 -0
  6. package/src/api/components/config.js +34 -0
  7. package/src/api/components/file.js +41 -0
  8. package/src/api/components/log.js +22 -0
  9. package/src/api/components/menu.js +68 -0
  10. package/src/api/components/mime.js +10 -0
  11. package/src/api/components/module.js +18 -0
  12. package/src/api/components/permission.js +25 -0
  13. package/src/api/components/role.js +73 -0
  14. package/src/api/components/tool.js +29 -0
  15. package/src/api/index.js +13 -0
  16. package/src/components/config-admin/index.vue +47 -0
  17. package/src/components/enum-checkbox/index.vue +31 -0
  18. package/src/components/enum-radio/index.vue +31 -0
  19. package/src/components/enum-select/index.vue +31 -0
  20. package/src/components/file-download/index.vue +81 -0
  21. package/src/components/file-img/index.vue +55 -0
  22. package/src/components/file-upload/index.vue +140 -0
  23. package/src/components/file-upload-img/index.vue +263 -0
  24. package/src/components/index.js +10 -0
  25. package/src/components/login-mode-select/index.vue +11 -0
  26. package/src/components/module-select/index.vue +11 -0
  27. package/src/components/platform-select/index.vue +28 -0
  28. package/src/components/role-select/index.vue +11 -0
  29. package/src/components/upload-mixins.js +127 -0
  30. package/src/config/index.js +18 -0
  31. package/src/index.js +69 -0
  32. package/src/main.js +5 -0
  33. package/src/module.js +10 -0
  34. package/src/routes/index.js +3 -0
  35. package/src/store/index.js +4 -0
  36. package/src/views/account/components/save/index.vue +65 -0
  37. package/src/views/account/index/cols.js +50 -0
  38. package/src/views/account/index/index.vue +127 -0
  39. package/src/views/account/index/page.js +57 -0
  40. package/src/views/auditInfo/components/details/index.vue +64 -0
  41. package/src/views/auditInfo/index/cols.js +63 -0
  42. package/src/views/auditInfo/index/index.vue +118 -0
  43. package/src/views/auditInfo/index/page.js +34 -0
  44. package/src/views/button/permission-bind/index.vue +50 -0
  45. package/src/views/cache/index/cols.js +10 -0
  46. package/src/views/cache/index/index.vue +64 -0
  47. package/src/views/cache/index/page.js +29 -0
  48. package/src/views/config/index.vue +43 -0
  49. package/src/views/config/library/components/auth/index.vue +165 -0
  50. package/src/views/config/library/components/component/index.vue +149 -0
  51. package/src/views/config/library/components/path/index.vue +45 -0
  52. package/src/views/config/library/components/quartz/index.vue +66 -0
  53. package/src/views/config/library/components/system/index.vue +58 -0
  54. package/src/views/config/library/form-mixins.js +25 -0
  55. package/src/views/config/library/index.vue +76 -0
  56. package/src/views/config/module/index.vue +64 -0
  57. package/src/views/config/page.js +21 -0
  58. package/src/views/file/index/cols.js +53 -0
  59. package/src/views/file/index/index.vue +52 -0
  60. package/src/views/file/index/page.js +42 -0
  61. package/src/views/home/components/bottom/index.vue +217 -0
  62. package/src/views/home/components/top-left/index.vue +43 -0
  63. package/src/views/home/components/top-right/index.vue +148 -0
  64. package/src/views/home/index.vue +27 -0
  65. package/src/views/home/page.js +15 -0
  66. package/src/views/icon/index.vue +92 -0
  67. package/src/views/icon/page.js +15 -0
  68. package/src/views/log/login-log/cols.js +43 -0
  69. package/src/views/log/login-log/index.vue +86 -0
  70. package/src/views/log/login-log/page.js +27 -0
  71. package/src/views/menu/components/add/components/link/index.vue +106 -0
  72. package/src/views/menu/components/add/components/mixins.js +83 -0
  73. package/src/views/menu/components/add/components/node/index.vue +53 -0
  74. package/src/views/menu/components/add/components/route/index.vue +122 -0
  75. package/src/views/menu/components/add/index.vue +86 -0
  76. package/src/views/menu/components/edit/components/link/index.vue +106 -0
  77. package/src/views/menu/components/edit/components/mixins.js +80 -0
  78. package/src/views/menu/components/edit/components/node/index.vue +53 -0
  79. package/src/views/menu/components/edit/components/route/index.vue +122 -0
  80. package/src/views/menu/components/edit/index.vue +95 -0
  81. package/src/views/menu/components/tree/index.vue +153 -0
  82. package/src/views/menu/index/cols.js +46 -0
  83. package/src/views/menu/index/index.vue +175 -0
  84. package/src/views/menu/index/page.js +48 -0
  85. package/src/views/mime/components/save/index.vue +45 -0
  86. package/src/views/mime/index/cols.js +16 -0
  87. package/src/views/mime/index/index.vue +55 -0
  88. package/src/views/mime/index/page.js +42 -0
  89. package/src/views/module/components/page-list/index.vue +234 -0
  90. package/src/views/module/components/permission-list/cols.js +36 -0
  91. package/src/views/module/components/permission-list/index.vue +90 -0
  92. package/src/views/module/index/index.vue +226 -0
  93. package/src/views/module/index/page.js +21 -0
  94. package/src/views/role/components/menu-bind/index.vue +85 -0
  95. package/src/views/role/components/page-bind/index.vue +221 -0
  96. package/src/views/role/components/platform-bind/index.vue +105 -0
  97. package/src/views/role/components/save/index.vue +45 -0
  98. package/src/views/role/components/tree/index.vue +112 -0
  99. package/src/views/role/index/index.vue +67 -0
  100. package/src/views/role/index/page.js +64 -0
@@ -0,0 +1,81 @@
1
+ <template>
2
+ <el-button
3
+ class="nm-button nm-file-download"
4
+ :type="type"
5
+ :size="size || fontSize"
6
+ :plain="plain"
7
+ :round="round"
8
+ :circle="circle"
9
+ :loading="loading"
10
+ :disabled="disabled"
11
+ :autofocus="autofocus"
12
+ :native-type="nativeType"
13
+ v-nm-has="code"
14
+ @click="onClick"
15
+ >
16
+ <nm-icon v-if="!loading && icon" :name="icon" />
17
+ <slot>
18
+ <span v-if="!circle && text" class="nm-button-text" v-html="text" />
19
+ </slot>
20
+ </el-button>
21
+ </template>
22
+ <script>
23
+ export default {
24
+ props: {
25
+ /** 文件链接 */
26
+ url: String,
27
+ /** 私有的 */
28
+ private: Boolean,
29
+ /** 文件名称 */
30
+ fileName: String,
31
+ /** 尺寸,默认按照框架的字号设置 */
32
+ size: String,
33
+ /** 类型 primary/success/warning/danger/info/text */
34
+ type: String,
35
+ /** 是否朴素按钮 */
36
+ plain: Boolean,
37
+ /** 是否圆角按钮 */
38
+ round: Boolean,
39
+ /** 是否圆形按钮 */
40
+ circle: Boolean,
41
+ /** 是否加载中状态 */
42
+ loading: Boolean,
43
+ /** 是否禁用状态 */
44
+ disabled: Boolean,
45
+ /** 是否默认聚焦 */
46
+ autofocus: Boolean,
47
+ /** 原生 type 属性 button/submit/reset */
48
+ nativeType: String,
49
+ /** 图标 */
50
+ icon: String,
51
+ // 文本
52
+ text: String,
53
+ // 按钮编码,用于按钮权限控制
54
+ code: String
55
+ },
56
+ methods: {
57
+ onClick() {
58
+ if (this.url) {
59
+ if (this.private) {
60
+ $api.admin.file.download(this.url)
61
+ } else {
62
+ //通过模拟a标签点击事件下载文件
63
+ const link = document.createElement('a')
64
+ link.href = this.url
65
+ let fileName = this.fileName
66
+ if (!fileName) {
67
+ let arr = this.url.split('/')
68
+ fileName = arr[arr.length - 1]
69
+ }
70
+ link.setAttribute('download', fileName)
71
+ link.setAttribute('target', '_blank')
72
+ document.body.appendChild(link)
73
+ link.click()
74
+ document.body.removeChild(link)
75
+ }
76
+ }
77
+ this.$emit('click')
78
+ }
79
+ }
80
+ }
81
+ </script>
@@ -0,0 +1,55 @@
1
+ <template>
2
+ <div :style="{ width, height }" class="nm-file-img-preview">
3
+ <img v-if="url__" :src="url__" />
4
+ <nm-icon class="no-picture" v-else name="photo" />
5
+ </div>
6
+ </template>
7
+ <script>
8
+ export default {
9
+ data() {
10
+ return {
11
+ url_: this.url,
12
+ url__: ''
13
+ }
14
+ },
15
+ props: {
16
+ url: {
17
+ type: String
18
+ },
19
+ //是否私有
20
+ private: Boolean,
21
+ width: {
22
+ type: String,
23
+ default: 'auto'
24
+ },
25
+ height: {
26
+ type: String,
27
+ default: 'auto'
28
+ }
29
+ },
30
+ watch: {
31
+ url: {
32
+ immediate: true,
33
+ handler(val) {
34
+ if (val !== this.url_) {
35
+ if (this.private && this.url) {
36
+ $api.admin.file.preview(this.url).then(url => {
37
+ this.url__ = url
38
+ })
39
+ } else {
40
+ this.url__ = val
41
+ }
42
+ }
43
+ }
44
+ }
45
+ }
46
+ }
47
+ </script>
48
+ <style lang="scss">
49
+ .nm-file-img-preview {
50
+ display: block;
51
+ img {
52
+ width: 100%;
53
+ }
54
+ }
55
+ </style>
@@ -0,0 +1,140 @@
1
+ <template>
2
+ <div class="nm-file-upload">
3
+ <div class="input">
4
+ <el-input :value="fileName" readonly :disabled="disabled" />
5
+ </div>
6
+ <div class="button">
7
+ <el-upload
8
+ ref="upload"
9
+ :action="action"
10
+ :headers="headers"
11
+ :data="uploadData"
12
+ name="formFile"
13
+ :disabled="disabled || loading"
14
+ :before-upload="onBeforeUpload"
15
+ :show-file-list="false"
16
+ :auto-upload="autoUpload"
17
+ :accept="accept"
18
+ :drag="false"
19
+ :on-success="onSuccess"
20
+ :on-error="onError"
21
+ >
22
+ <nm-button :type="btnType" text="上传" :icon="loading ? 'loading' : noIcon ? '' : 'upload'" :loading="loading" :disabled="disabled" />
23
+ </el-upload>
24
+ </div>
25
+ </div>
26
+ </template>
27
+ <script>
28
+ import mixins from '../upload-mixins'
29
+ export default {
30
+ mixins: [mixins],
31
+ data() {
32
+ return {
33
+ value_: this.value,
34
+ fileName: ''
35
+ }
36
+ },
37
+ props: {
38
+ value: {
39
+ type: String
40
+ },
41
+ /** 按钮类型 */
42
+ btnType: {
43
+ type: String,
44
+ default: 'primary'
45
+ },
46
+ /** 不显示按钮图标 */
47
+ noIcon: Boolean
48
+ },
49
+ methods: {
50
+ onBeforeUpload(file) {
51
+ // 文件格式验证
52
+ if (!this.verifyFileType(file)) {
53
+ return false
54
+ }
55
+ // 验证是否超出最大上传数
56
+ if (this.maxSizeBytes && file.size > this.maxSizeBytes) {
57
+ this._error(`文件大小${this.getSizeUnit(file.size)}超过了最大允许值${this.maxSize}`)
58
+ return false
59
+ }
60
+ if (this.beforeUpload && typeof this.beforeUpload === 'function' && !this.beforeUpload(file)) {
61
+ return false
62
+ }
63
+
64
+ this.loading = true
65
+ return true
66
+ },
67
+ onSuccess(res, file) {
68
+ if (res.code === 1) {
69
+ const data = res.data
70
+ this.value_ = data.fullPath
71
+ this.fileName = file.name
72
+ this.$emit('input', this.value_)
73
+ this.$emit('success', data, file)
74
+ } else {
75
+ this._error(res.msg)
76
+ this.$emit('error')
77
+ }
78
+ this.loading = false
79
+ },
80
+ reset() {
81
+ this.value_ = ''
82
+ this.fileName = ''
83
+ this.$emit('input', this.value_)
84
+ },
85
+ get() {
86
+ if (this.value_) {
87
+ $api.admin.file.getByFullPath(this.value_).then(data => {
88
+ this.fileName = data.fileName
89
+ })
90
+ } else {
91
+ this.fileName = ''
92
+ }
93
+ }
94
+ },
95
+ watch: {
96
+ value: {
97
+ immediate: true,
98
+ handler(val) {
99
+ if (val !== this.value_) {
100
+ this.value_ = val
101
+ this.get()
102
+ }
103
+ }
104
+ }
105
+ }
106
+ }
107
+ </script>
108
+
109
+ <style lang="scss">
110
+ .nm-file-upload {
111
+ position: relative;
112
+ padding-right: 80px;
113
+ width: 100%;
114
+ box-sizing: border-box;
115
+ .input {
116
+ .el-input__inner {
117
+ border-top-right-radius: 0;
118
+ border-bottom-right-radius: 0;
119
+ }
120
+ }
121
+ .button {
122
+ position: absolute;
123
+ right: 0;
124
+ top: 0;
125
+ width: 80px;
126
+ height: 100%;
127
+
128
+ > div,
129
+ .el-upload,
130
+ .nm-button {
131
+ height: 100%;
132
+ }
133
+
134
+ .nm-button {
135
+ border-top-left-radius: 0;
136
+ border-bottom-left-radius: 0;
137
+ }
138
+ }
139
+ }
140
+ </style>
@@ -0,0 +1,263 @@
1
+ <template>
2
+ <div :class="['nm-file-upload-img', disabled ? 'disabled' : '']" :style="{ width, height }" v-loading="loading">
3
+ <div v-if="disabled" class="disabled-bg"></div>
4
+ <el-upload
5
+ ref="upload"
6
+ :action="action"
7
+ :headers="headers"
8
+ :data="uploadData"
9
+ name="formFile"
10
+ :disabled="disabled || loading"
11
+ :before-upload="onBeforeUpload"
12
+ :show-file-list="false"
13
+ :auto-upload="autoUpload"
14
+ :accept="accept"
15
+ :drag="drag"
16
+ :on-success="onSuccess"
17
+ :on-error="onError"
18
+ >
19
+ <nm-file-img v-show="value_" :url="url" :private="accessMode !== 1" class="preview" />
20
+ <div v-show="!value_" class="text-box">
21
+ <i class="el-icon-upload" :style="{ fontSize: iconSize }"></i>
22
+ <div v-if="!noText" class="text">
23
+ <slot name="text">
24
+ 将文件拖到此处,或
25
+ <em>点击上传</em>
26
+ </slot>
27
+ </div>
28
+ <div class="tip">
29
+ <slot name="tip">{{ tip }}</slot>
30
+ </div>
31
+ </div>
32
+ </el-upload>
33
+ <span v-show="value_" class="remove" @click="reset">
34
+ <nm-icon name="close" />
35
+ </span>
36
+ </div>
37
+ </template>
38
+ <script>
39
+ import mixins from '../upload-mixins'
40
+
41
+ export default {
42
+ mixins: [mixins],
43
+ data() {
44
+ return {
45
+ value_: this.value,
46
+ url: ''
47
+ }
48
+ },
49
+ props: {
50
+ value: {
51
+ type: String
52
+ },
53
+ /** 宽度 */
54
+ width: {
55
+ type: String,
56
+ default: '100px'
57
+ },
58
+ /** 高度 */
59
+ height: {
60
+ type: String,
61
+ default: '150px'
62
+ },
63
+ /** 文本说明 */
64
+ text: String,
65
+ /** 底部提示语 */
66
+ tip: String,
67
+ /** 接受上传的文件类型 */
68
+ accept: {
69
+ type: String,
70
+ default: 'image/jpeg,image/png'
71
+ },
72
+ /** 可接受文件类型 */
73
+ fileType: {
74
+ type: Array,
75
+ default() {
76
+ return ['jpg', 'jpeg', 'png']
77
+ }
78
+ },
79
+ /** 图标大小 */
80
+ iconSize: {
81
+ type: String,
82
+ default: '5em'
83
+ },
84
+ /**不显示文本 */
85
+ noText: Boolean
86
+ },
87
+ methods: {
88
+ onBeforeUpload(file) {
89
+ // 文件格式验证
90
+ if (!this.verifyFileType(file)) {
91
+ return false
92
+ }
93
+ // 验证是否超出最大上传数
94
+ if (this.maxSizeBytes && file.size > this.maxSizeBytes) {
95
+ this._error(`文件大小${this.getSizeUnit(file.size)}超过了最大允许值${this.maxSize}`)
96
+ return false
97
+ }
98
+ if (this.beforeUpload && typeof this.beforeUpload === 'function' && !this.beforeUpload(file)) {
99
+ return false
100
+ }
101
+
102
+ this.loading = true
103
+ return true
104
+ },
105
+ onSuccess(res, file) {
106
+ if (res.code === 1) {
107
+ const data = res.data
108
+ this.value_ = data.fullPath
109
+ this.url = data.url
110
+ this.$emit('input', this.value_)
111
+ this.$emit('success', data, file)
112
+ } else {
113
+ this._error(res.msg)
114
+ this.$emit('error')
115
+ }
116
+ this.loading = false
117
+ },
118
+ reset() {
119
+ this.value_ = ''
120
+ this.url = ''
121
+ this.$emit('input', this.value_)
122
+ },
123
+ get() {
124
+ if (this.value_) {
125
+ $api.admin.file.getByFullPath(this.value_).then(data => {
126
+ this.url = data.url
127
+ })
128
+ } else {
129
+ this.url = ''
130
+ }
131
+ }
132
+ },
133
+ watch: {
134
+ value: {
135
+ immediate: true,
136
+ handler(val) {
137
+ if (val !== this.value_) {
138
+ this.value_ = val
139
+ this.get()
140
+ }
141
+ }
142
+ }
143
+ }
144
+ }
145
+ </script>
146
+
147
+ <style lang="scss">
148
+ .nm-file-upload-img {
149
+ position: relative;
150
+ display: inline-block;
151
+ box-sizing: border-box;
152
+ border: 1px dashed #ccc;
153
+ background-color: #fff;
154
+ text-align: center;
155
+ color: #8c939d;
156
+ cursor: pointer;
157
+ border-radius: 5px;
158
+ overflow: hidden;
159
+
160
+ > div {
161
+ width: 100%;
162
+ height: 100%;
163
+ }
164
+
165
+ .preview {
166
+ width: 100%;
167
+ height: 100%;
168
+ line-height: 100%;
169
+ text-align: center;
170
+ img {
171
+ max-width: 100%;
172
+ max-height: 100%;
173
+ }
174
+ .no-picture {
175
+ font-size: 2em;
176
+ }
177
+ }
178
+
179
+ .el-upload {
180
+ width: 100%;
181
+ height: 100%;
182
+ }
183
+
184
+ .el-upload-dragger {
185
+ position: relative;
186
+ top: 50%;
187
+ border: none;
188
+ margin-top: -50%;
189
+ width: 100%;
190
+ height: auto;
191
+
192
+ .text-box {
193
+ font-size: 14px;
194
+
195
+ .el-icon-upload {
196
+ margin: auto;
197
+ font-size: 5em;
198
+ color: #c0c4cc !important;
199
+ }
200
+
201
+ em {
202
+ color: #409eff;
203
+ font-style: normal;
204
+ }
205
+
206
+ .text {
207
+ font-size: 13px;
208
+ line-height: 130%;
209
+ }
210
+ }
211
+ }
212
+
213
+ .el-loading-spinner {
214
+ line-height: 100%;
215
+ }
216
+
217
+ .remove {
218
+ position: absolute;
219
+ display: none;
220
+ top: 0;
221
+ right: 0;
222
+ width: 30px;
223
+ height: 30px;
224
+ line-height: 27px;
225
+ border-radius: 15px;
226
+ background-color: #f56c6c;
227
+ color: #ccc;
228
+ font-size: 16px;
229
+
230
+ &:hover {
231
+ color: #fff;
232
+ }
233
+ }
234
+
235
+ &:hover {
236
+ border-color: #409eff;
237
+
238
+ .remove {
239
+ display: inline-block;
240
+ }
241
+ }
242
+
243
+ &.disabled:hover {
244
+ border: 1px dashed #ccc;
245
+
246
+ .remove {
247
+ display: none;
248
+ }
249
+ }
250
+
251
+ .disabled-bg {
252
+ position: absolute;
253
+ top: 0;
254
+ left: 0;
255
+ width: 100%;
256
+ height: 100%;
257
+ background-color: #f5f7fa;
258
+ z-index: 999;
259
+ opacity: 0.5;
260
+ cursor: not-allowed;
261
+ }
262
+ }
263
+ </style>
@@ -0,0 +1,10 @@
1
+ import library from 'netmodular-ui/packages/library'
2
+ let components = []
3
+ const requireComponent = require.context('./', true, /index\.vue$/)
4
+ requireComponent.keys().map(fileName => {
5
+ components.push({
6
+ name: `${library.prefix.toLowerCase()}-${fileName.split('/')[1]}`,
7
+ component: requireComponent(fileName).default
8
+ })
9
+ })
10
+ export default components
@@ -0,0 +1,11 @@
1
+ <script>
2
+ import { mixins } from 'netmodular-ui'
3
+ export default {
4
+ mixins: [mixins.select],
5
+ data() {
6
+ return {
7
+ action: $api.admin.tool.loginModeSelect
8
+ }
9
+ }
10
+ }
11
+ </script>
@@ -0,0 +1,11 @@
1
+ <script>
2
+ import { mixins } from 'netmodular-ui'
3
+ export default {
4
+ mixins: [mixins.select],
5
+ data() {
6
+ return {
7
+ action: $api.admin.module.select
8
+ }
9
+ }
10
+ }
11
+ </script>
@@ -0,0 +1,28 @@
1
+ <script>
2
+ import { mixins } from 'netmodular-ui'
3
+ export default {
4
+ mixins: [mixins.select],
5
+ data() {
6
+ return {
7
+ action: this.query
8
+ }
9
+ },
10
+ props: {
11
+ /**不包含Web */
12
+ noWeb: Boolean
13
+ },
14
+ methods: {
15
+ query() {
16
+ return new Promise(resolve => {
17
+ $api.admin.tool.platformSelect().then(data => {
18
+ let options = data
19
+ if (this.noWeb) {
20
+ options = data.filter(m => m.value > 0)
21
+ }
22
+ resolve(options)
23
+ })
24
+ })
25
+ }
26
+ }
27
+ }
28
+ </script>
@@ -0,0 +1,11 @@
1
+ <script>
2
+ import { mixins } from 'netmodular-ui'
3
+ export default {
4
+ mixins: [mixins.select],
5
+ data() {
6
+ return {
7
+ action: $api.admin.role.select
8
+ }
9
+ }
10
+ }
11
+ </script>