haiwei-module-admin 1.0.0 → 1.0.2

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 (44) hide show
  1. package/.browserslistrc +2 -0
  2. package/.eslintrc.js +18 -0
  3. package/.prettierrc +6 -0
  4. package/.vscode/settings.json +10 -0
  5. package/babel.config.js +10 -0
  6. package/package.json +9 -17
  7. package/postcss.config.js +5 -0
  8. package/script/npm_install.bat +4 -0
  9. package/script/npm_install.ps1 +3 -0
  10. package/script/npm_publish.bat +4 -0
  11. package/script/npm_publish.ps1 +3 -0
  12. package/script/npm_update.bat +4 -0
  13. package/script/npm_update.ps1 +3 -0
  14. package/src/api/components/file.js +3 -0
  15. package/src/components/enum-checkbox/index.vue +1 -1
  16. package/src/components/enum-radio/index.vue +1 -1
  17. package/src/components/enum-select/index.vue +1 -1
  18. package/src/components/file-preview/index copy.vue +531 -0
  19. package/src/components/file-preview/index.vue +534 -0
  20. package/src/components/index.js +1 -1
  21. package/src/components/login-mode-select/index.vue +1 -1
  22. package/src/components/module-select/index.vue +1 -1
  23. package/src/components/platform-select/index.vue +1 -1
  24. package/src/components/role-select/index.vue +1 -1
  25. package/src/index.js +6 -6
  26. package/src/routes/index.js +1 -1
  27. package/src/views/account/components/save/index.vue +1 -1
  28. package/src/views/account/index/index.vue +1 -1
  29. package/src/views/auditInfo/components/details/index.vue +1 -1
  30. package/src/views/button/permission-bind/index.vue +1 -1
  31. package/src/views/cache/index/index.vue +1 -1
  32. package/src/views/file/components/save/index.vue +106 -0
  33. package/src/views/file/index/index.vue +54 -3
  34. package/src/views/file/index/page.js +8 -0
  35. package/src/views/menu/components/add/index.vue +1 -1
  36. package/src/views/menu/components/edit/index.vue +1 -1
  37. package/src/views/mime/components/save/index.vue +1 -1
  38. package/src/views/mime/index/index.vue +1 -1
  39. package/src/views/module/components/page-list/index.vue +1 -1
  40. package/src/views/module/components/permission-list/index.vue +1 -1
  41. package/src/views/role/components/platform-bind/index.vue +1 -1
  42. package/src/views/role/components/save/index.vue +1 -1
  43. package/src/views/role/index/index.vue +1 -1
  44. package/vue.config.js +118 -0
@@ -0,0 +1,106 @@
1
+ <template>
2
+ <nm-form-dialog ref="form" v-bind="form" v-on="on" :visible.sync="visible_">
3
+ <el-row>
4
+ <el-col :span="20" :offset="1">
5
+ <el-form-item label="模块:" prop="moduleCode">
6
+ <nm-module-select v-model="form.model.moduleCode" />
7
+ </el-form-item>
8
+ <el-form-item label="分组:" prop="group">
9
+ <el-input v-model="form.model.group" />
10
+ </el-form-item>
11
+ <el-form-item label="访问方式:" prop="accessMode">
12
+ <el-select v-model="form.model.accessMode" placeholder="请选择访问方式">
13
+ <el-option label="私有" :value="0" />
14
+ <el-option label="公开" :value="1" />
15
+ <el-option label="授权" :value="2" />
16
+ </el-select>
17
+ </el-form-item>
18
+ <el-form-item v-if="form.model.accessMode === 2" label="授权账户:" prop="accounts">
19
+ <el-input v-model="form.model.accounts" placeholder="请输入账户ID,多个用逗号分隔" clearable />
20
+ </el-form-item>
21
+ <el-form-item label="文件:" prop="filePath" :rules="[{ required: true, message: '请选择要上传的文件' }]">
22
+ <nm-file-upload
23
+ v-model="form.model.filePath"
24
+ :module="form.model.moduleCode"
25
+ :group="form.model.group"
26
+ :access-mode="form.model.accessMode"
27
+ :accounts="form.model.accounts"
28
+ max-size="50MB"
29
+ @success="onUploadSuccess"
30
+ />
31
+ </el-form-item>
32
+ </el-col>
33
+ </el-row>
34
+ </nm-form-dialog>
35
+ </template>
36
+ <script>
37
+ import { mixins } from 'haiwei-ui'
38
+
39
+ export default {
40
+ mixins: [mixins.formSave],
41
+ data() {
42
+ return {
43
+ title: '文件上传',
44
+ actions: {
45
+ add: null, // 将在created中设置
46
+ edit: null, // 禁用编辑功能
47
+ update: null // 禁用更新功能
48
+ },
49
+ form: {
50
+ width: '600px',
51
+ footer: false, // 隐藏确定/取消按钮
52
+ model: {
53
+ id: '',
54
+ moduleCode: '',
55
+ group: '',
56
+ accessMode: 1, // 默认公开
57
+ accounts: '',
58
+ filePath: '' // 文件路径
59
+ },
60
+ rules: {
61
+ moduleCode: [{ required: true, message: '请选择模块' }],
62
+ group: [{ required: true, message: '请输入分组' }],
63
+ accessMode: [{ required: true, message: '请选择访问方式' }],
64
+ filePath: [{ required: true, message: '请选择要上传的文件' }]
65
+ }
66
+ }
67
+ }
68
+ },
69
+ created() {
70
+ // 由于隐藏了按钮,不需要设置actions.add
71
+ // this.actions.add = this.handleAdd
72
+ },
73
+ methods: {
74
+ // 上传成功处理(由nm-file-upload组件触发)
75
+ onUploadSuccess(data, file) {
76
+ // 文件上传成功后,nm-file-upload会自动更新form.model.filePath
77
+ // 显示成功消息
78
+ this.$message.success('文件上传成功')
79
+
80
+ // 触发success事件,通知父组件刷新列表
81
+ this.$emit('success')
82
+
83
+ // 自动关闭对话框
84
+ this.visible_ = false
85
+
86
+ // 重置表单
87
+ this.reset()
88
+
89
+ // 可以添加额外的成功处理逻辑
90
+ console.log('文件上传成功:', data, file)
91
+ },
92
+
93
+ // 重置表单
94
+ reset() {
95
+ this.form.model = {
96
+ id: '',
97
+ moduleCode: '',
98
+ group: '',
99
+ accessMode: 1,
100
+ accounts: '',
101
+ filePath: ''
102
+ }
103
+ }
104
+ }
105
+ }
106
+ </script>
@@ -11,6 +11,42 @@
11
11
  </el-form-item>
12
12
  </template>
13
13
 
14
+ <!--高级查询-->
15
+ <template v-slot:querybar-advanced>
16
+ <el-row>
17
+ <el-col :span="20" :offset="1">
18
+ <el-form-item label="分组:" prop="group">
19
+ <el-input v-model="list.model.group" clearable />
20
+ </el-form-item>
21
+ <el-form-item label="访问方式:" prop="accessMode">
22
+ <el-select v-model="list.model.accessMode" placeholder="请选择访问方式" clearable>
23
+ <el-option label="私有" :value="0" />
24
+ <el-option label="公开" :value="1" />
25
+ <el-option label="授权" :value="2" />
26
+ </el-select>
27
+ </el-form-item>
28
+ </el-col>
29
+ </el-row>
30
+ </template>
31
+
32
+ <!--按钮-->
33
+ <template v-slot:querybar-buttons>
34
+ <nm-button v-bind="buttons.add" @click="add" />
35
+ </template>
36
+
37
+ <!-- 文件预览列 -->
38
+ <template v-slot:col-fullPath="{ row }">
39
+ <nm-file-preview :fullPath="row.fullPath" :fileName="row.fileName" :ext="row.ext" :isPrivate="row.accessMode !== 1" />
40
+ <!-- <nm-file-preview :fullPath="row.fullPath"/> -->
41
+ </template>
42
+
43
+ <!--访问方式-->
44
+ <template v-slot:col-accessModeName="{ row }">
45
+ <el-tag v-if="row.accessMode === 0" type="info">私有</el-tag>
46
+ <el-tag v-else-if="row.accessMode === 1" type="success">公开</el-tag>
47
+ <el-tag v-else-if="row.accessMode === 2" type="warning">授权</el-tag>
48
+ </template>
49
+
14
50
  <!--操作列-->
15
51
  <template v-slot:col-operation="{ row }">
16
52
  <nm-file-download v-bind="buttons.export" :url="row.url" :private="row.accessMode !== 1" @success="refresh" />
@@ -18,12 +54,16 @@
18
54
  <nm-button-delete v-bind="buttons.hardDel" :id="row.id" :action="hardRemoveAction" @success="refresh" />
19
55
  </template>
20
56
  </nm-list>
57
+
58
+ <!--保存页-->
59
+ <save-page :visible.sync="dialog.save" @success="refresh" />
21
60
  </nm-container>
22
61
  </template>
23
62
  <script>
24
- import { mixins } from 'netmodular-ui'
63
+ import { mixins } from 'haiwei-ui'
25
64
  import page from './page'
26
65
  import cols from './cols'
66
+ import SavePage from '../components/save'
27
67
 
28
68
  // 接口
29
69
  const api = $api.admin.file
@@ -31,22 +71,33 @@ const api = $api.admin.file
31
71
  export default {
32
72
  name: page.name,
33
73
  mixins: [mixins.list],
74
+ components: { SavePage },
34
75
  data() {
35
76
  return {
36
77
  list: {
37
78
  title: page.title,
38
79
  cols,
39
80
  action: api.query,
40
- operationWidth: '200',
81
+ operationWidth: '270',
82
+ advanced: {
83
+ enabled: true,
84
+ width: '400px'
85
+ },
41
86
  model: {
42
87
  moduleCode: '',
43
- fileName: ''
88
+ fileName: '',
89
+ group: '',
90
+ accessMode: ''
44
91
  }
45
92
  },
46
93
  removeAction: api.remove,
47
94
  hardRemoveAction: api.hardDelete,
48
95
  buttons: page.buttons
49
96
  }
97
+ },
98
+ methods: {
99
+ // 上传(新增)- 使用混入的add方法打开对话框
100
+ // add方法已在mixins.list中定义,会设置dialog.save = true
50
101
  }
51
102
  }
52
103
  </script>
@@ -8,7 +8,15 @@ const page = new (function() {
8
8
  // 关联权限
9
9
  this.permissions = [`${this.name}_query_get`]
10
10
 
11
+ // 按钮
11
12
  this.buttons = {
13
+ add: {
14
+ text: '上传',
15
+ type: 'success',
16
+ icon: 'upload',
17
+ code: `${this.name}_add`,
18
+ permissions: [`${this.name}_add_post`]
19
+ },
12
20
  export: {
13
21
  text: '导出',
14
22
  type: 'text',
@@ -21,7 +21,7 @@
21
21
  </nm-dialog>
22
22
  </template>
23
23
  <script>
24
- import { mixins } from 'netmodular-ui'
24
+ import { mixins } from 'haiwei-ui'
25
25
  import NodeMenu from './components/node'
26
26
  import RouteMenu from './components/route'
27
27
  import LinkMenu from './components/link'
@@ -10,7 +10,7 @@
10
10
  </nm-dialog>
11
11
  </template>
12
12
  <script>
13
- import { mixins } from 'netmodular-ui'
13
+ import { mixins } from 'haiwei-ui'
14
14
  import NodeMenu from './components/node'
15
15
  import RouteMenu from './components/route'
16
16
  import LinkMenu from './components/link'
@@ -13,7 +13,7 @@
13
13
  </nm-form-dialog>
14
14
  </template>
15
15
  <script>
16
- import { mixins } from 'netmodular-ui'
16
+ import { mixins } from 'haiwei-ui'
17
17
 
18
18
  // 接口
19
19
  const { add, edit, update } = $api.admin.mime
@@ -25,7 +25,7 @@
25
25
  </nm-container>
26
26
  </template>
27
27
  <script>
28
- import { mixins } from 'netmodular-ui'
28
+ import { mixins } from 'haiwei-ui'
29
29
  import page from './page'
30
30
  import cols from './cols'
31
31
  import SavePage from '../components/save'
@@ -102,7 +102,7 @@
102
102
  </template>
103
103
  <script>
104
104
  import { mapState } from 'vuex'
105
- import { mixins } from 'netmodular-ui'
105
+ import { mixins } from 'haiwei-ui'
106
106
 
107
107
  const { queryByCodes } = $api.admin.permission
108
108
 
@@ -14,7 +14,7 @@
14
14
  </nm-list-dialog>
15
15
  </template>
16
16
  <script>
17
- import { mixins } from 'netmodular-ui'
17
+ import { mixins } from 'haiwei-ui'
18
18
  import cols from './cols'
19
19
  const { query } = $api.admin.permission
20
20
 
@@ -25,7 +25,7 @@
25
25
  </nm-box>
26
26
  </template>
27
27
  <script>
28
- import { mixins } from 'netmodular-ui'
28
+ import { mixins } from 'haiwei-ui'
29
29
  const api = $api.admin.permission
30
30
  const { queryBindPlatformPermissions, bindPlatformPermissions } = $api.admin.role
31
31
  export default {
@@ -13,7 +13,7 @@
13
13
  </nm-form-dialog>
14
14
  </template>
15
15
  <script>
16
- import { mixins } from 'netmodular-ui'
16
+ import { mixins } from 'haiwei-ui'
17
17
 
18
18
  // 接口
19
19
  const { add, edit, update } = $api.admin.role
@@ -26,7 +26,7 @@
26
26
  </nm-container>
27
27
  </template>
28
28
  <script>
29
- import { mixins } from 'netmodular-ui'
29
+ import { mixins } from 'haiwei-ui'
30
30
  import page from './page'
31
31
  import RoleTree from '../components/tree'
32
32
  import MenuBind from '../components/menu-bind'
package/vue.config.js ADDED
@@ -0,0 +1,118 @@
1
+ const path = require('path')
2
+ const CopyWebpackPlugin = require('copy-webpack-plugin')
3
+ const TerserPlugin = require('terser-webpack-plugin')
4
+ // 开发环境
5
+ const isDev = process.env.NODE_ENV === 'development'
6
+ // 打包输出路径
7
+ const outputDir = '../../WebHost/wwwroot/app'
8
+
9
+ // 环境变量
10
+ /**版权信息 */
11
+ process.env.VUE_APP_COPYRIGHT = '版权所有:尼古拉斯·老李 | 用代码改变世界'
12
+ /**版本号 */
13
+ process.env.VUE_APP_BUILD_TIME = require('dayjs')().format('YYYYMDHHmmss')
14
+ /**第三方依赖组件,写法示例:<script src="./lib/font.js"></script> */
15
+ process.env.VUE_APP_CUSTOM_SCRIPTS = ''
16
+
17
+ module.exports = {
18
+ outputDir: outputDir,
19
+ publicPath: '/app',
20
+ devServer: {
21
+ port: 5220
22
+ },
23
+ transpileDependencies: ['haiwei-*', 'element-ui'],
24
+ configureWebpack() {
25
+ let config = {
26
+ plugins: [
27
+ /**
28
+ * 复制haiwei-ui/public目录下的文件到输出目录
29
+ */
30
+ new CopyWebpackPlugin([
31
+ {
32
+ from: path.join(__dirname, 'node_modules/haiwei-ui/public'),
33
+ to: path.join(__dirname, outputDir),
34
+ ignore: ['index.html']
35
+ }
36
+ ])
37
+ ]
38
+ }
39
+
40
+ if (!isDev) {
41
+ //自定义代码压缩
42
+ config.optimization = {
43
+ minimize: true,
44
+ minimizer: [
45
+ new TerserPlugin({
46
+ cache: true,
47
+ parallel: true,
48
+ sourceMap: false,
49
+ terserOptions: {
50
+ compress: {
51
+ drop_console: true,
52
+ drop_debugger: true
53
+ }
54
+ }
55
+ })
56
+ ]
57
+ }
58
+ }
59
+ return config
60
+ },
61
+ chainWebpack: config => {
62
+ /**
63
+ * 删除懒加载模块的 prefetch preload,降低带宽压力
64
+ * https://cli.vuejs.org/zh/guide/html-and-static-assets.html#prefetch
65
+ * https://cli.vuejs.org/zh/guide/html-and-static-assets.html#preload
66
+ * 而且预渲染时生成的 prefetch 标签是 modern 版本的,低版本浏览器是不需要的
67
+ */
68
+ config.plugins.delete('prefetch').delete('preload')
69
+
70
+ /**
71
+ * 设置index.html模板路径,使用haiwei-ui/public中的模板
72
+ */
73
+ config.plugin('html').tap(args => {
74
+ args[0].template = './node_modules/haiwei-ui/public/index.html'
75
+ return args
76
+ })
77
+
78
+ config
79
+ // 开发环境
80
+ .when(
81
+ isDev,
82
+ // sourcemap不包含列信息
83
+ config => config.devtool('cheap-source-map')
84
+ )
85
+ // 非开发环境
86
+ .when(!isDev, config => {
87
+ // 拆分
88
+ config.optimization.splitChunks({
89
+ chunks: 'all',
90
+ cacheGroups: {
91
+ elementUI: {
92
+ name: 'chunk-element-ui',
93
+ priority: 20,
94
+ test: /[\\/]node_modules[\\/]element-ui(.*)/
95
+ },
96
+ skins: {
97
+ name: 'chunk-haiwei-ui',
98
+ priority: 10,
99
+ test: /[\\/]node_modules[\\/]haiwei-ui(.*)/
100
+ }
101
+ }
102
+ })
103
+
104
+ config.optimization.runtimeChunk({
105
+ name: 'manifest'
106
+ })
107
+ })
108
+ },
109
+ css: {
110
+ loaderOptions: {
111
+ sass: {
112
+ sassOptions: {
113
+ silenceDeprecations: ['import', 'legacy-js-api', 'bogus-combinators', 'slash-div']
114
+ }
115
+ }
116
+ }
117
+ }
118
+ }