@scx-js/scx-admin 0.0.3

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 (84) hide show
  1. package/components/crud/crud-add-button.vue +28 -0
  2. package/components/crud/crud-batch-delete.vue +27 -0
  3. package/components/crud/crud-edit-dialog.vue +36 -0
  4. package/components/crud/crud-edit-form.vue +28 -0
  5. package/components/crud/crud-form-footer.vue +28 -0
  6. package/components/crud/crud-pagination.vue +51 -0
  7. package/components/crud/crud-reset-button.vue +19 -0
  8. package/components/crud/crud-search-button.vue +25 -0
  9. package/components/crud/crud-table-delete-button.vue +31 -0
  10. package/components/crud/crud-table-edit-button.vue +26 -0
  11. package/components/crud/crud-table.vue +131 -0
  12. package/components/crud/index.css +46 -0
  13. package/components/crud/index.vue +37 -0
  14. package/components/easy-ckeditor/default-editor-config.js +199 -0
  15. package/components/easy-ckeditor/easy-ckeditor-lazy.css +17 -0
  16. package/components/easy-ckeditor/easy-ckeditor-lazy.vue +106 -0
  17. package/components/easy-ckeditor/index.css +3 -0
  18. package/components/easy-ckeditor/index.vue +58 -0
  19. package/components/easy-ckeditor/plugins/scx-upload-adapter.js +39 -0
  20. package/components/easy-form-item/index.vue +168 -0
  21. package/components/easy-image/index.css +24 -0
  22. package/components/easy-image/index.vue +75 -0
  23. package/components/easy-monaco-editor/index.css +8 -0
  24. package/components/easy-monaco-editor/index.vue +70 -0
  25. package/components/easy-monaco-editor/use-worker.js +27 -0
  26. package/components/easy-select/index.vue +29 -0
  27. package/components/easy-upload/index.vue +94 -0
  28. package/components/easy-upload-list/index.vue +107 -0
  29. package/components/index.js +69 -0
  30. package/components/left-tree/index.css +74 -0
  31. package/components/left-tree/index.vue +130 -0
  32. package/components/scx-container/index.css +19 -0
  33. package/components/scx-container/index.vue +22 -0
  34. package/components/user-profile/change-password-dialog.vue +100 -0
  35. package/components/user-profile/change-user-avatar.vue +43 -0
  36. package/components/user-profile/change-username-dialog.vue +82 -0
  37. package/components/user-profile/index.css +8 -0
  38. package/components/user-profile/index.vue +77 -0
  39. package/index.js +4 -0
  40. package/layout/img/default-avatar.gif +0 -0
  41. package/layout/index.vue +24 -0
  42. package/layout/scx-app.vue +110 -0
  43. package/layout/scx-input.vue +84 -0
  44. package/layout/scx-logo.vue +65 -0
  45. package/layout/scx-main.vue +48 -0
  46. package/layout/scx-menu-item.vue +47 -0
  47. package/layout/scx-menu-toggle.vue +69 -0
  48. package/layout/scx-menu.vue +122 -0
  49. package/layout/scx-navbar.vue +47 -0
  50. package/layout/scx-notice.vue +211 -0
  51. package/layout/scx-sidebar.vue +70 -0
  52. package/layout/scx-theme-switch.vue +54 -0
  53. package/layout/scx-user-panel.vue +193 -0
  54. package/package.json +30 -0
  55. package/routes.js +57 -0
  56. package/scx/ali-oss.js +87 -0
  57. package/scx/auth-fetch.js +68 -0
  58. package/scx/crud-context.js +522 -0
  59. package/scx/easy-option.js +131 -0
  60. package/scx/index.js +8 -0
  61. package/scx/scx-auth-info.js +48 -0
  62. package/scx/scx-auth.js +197 -0
  63. package/scx/scx-config-manager.js +105 -0
  64. package/scx/scx-router.js +273 -0
  65. package/styles/index.css +37 -0
  66. package/util/cities.js +350 -0
  67. package/util/duration-format.js +27 -0
  68. package/util/element-plus-helper.js +114 -0
  69. package/util/get-order-number.js +7 -0
  70. package/util/index.js +4 -0
  71. package/util/nations.js +16 -0
  72. package/util/provinces.js +41 -0
  73. package/views/error-page.vue +79 -0
  74. package/views/login/index.css +95 -0
  75. package/views/login/login-and-register.vue +66 -0
  76. package/views/login/login-bg.vue +121 -0
  77. package/views/login/login-form-bg.vue +61 -0
  78. package/views/login/login-form.vue +137 -0
  79. package/views/login/login-message.js +28 -0
  80. package/views/login/login.vue +29 -0
  81. package/views/login/register-form.vue +148 -0
  82. package/views/no-perm.vue +7 -0
  83. package/views/not-found.vue +7 -0
  84. package/views/rocket.vue +84 -0
@@ -0,0 +1,28 @@
1
+ <template>
2
+
3
+ <el-button type="success"
4
+ @click="crudContext.handleCreate()">
5
+ <scx-icon icon="outlined-plus-circle"/>
6
+ <span>添加</span>
7
+ </el-button>
8
+
9
+ </template>
10
+
11
+ <script>
12
+ import {useCrudContext} from "../../index.js";
13
+
14
+ export default {
15
+ name: "crud-add-button",
16
+ setup(props, context) {
17
+ const crudContext = useCrudContext();
18
+
19
+ return {
20
+ crudContext
21
+ };
22
+ }
23
+ };
24
+ </script>
25
+
26
+ <style scoped>
27
+
28
+ </style>
@@ -0,0 +1,27 @@
1
+ <template>
2
+
3
+ <el-popconfirm title="确定删除全部选中数据 (不可恢复) ?" @confirm="crudContext.batchDelete()">
4
+ <template #reference>
5
+ <el-button class="footer-item" plain type="danger">批量删除</el-button>
6
+ </template>
7
+ </el-popconfirm>
8
+
9
+ </template>
10
+
11
+ <script>
12
+ import {useCrudContext} from "../../index.js";
13
+
14
+ export default {
15
+ name: "crud-batch-delete",
16
+ setup() {
17
+
18
+ const crudContext = useCrudContext();
19
+
20
+ return {crudContext};
21
+ }
22
+ };
23
+ </script>
24
+
25
+ <style scoped>
26
+
27
+ </style>
@@ -0,0 +1,36 @@
1
+ <template>
2
+
3
+ <el-dialog v-model="crudContext.editDialog.visible" :close-on-click-modal="false"
4
+ :title="crudContext.getDialogTitle()"
5
+ append-to-body
6
+ width="60%">
7
+ <slot></slot>
8
+ <template v-slot:footer>
9
+ <el-button :loading="crudContext.editDialog.confirmButtonLoading" type="primary"
10
+ @click="crudContext.createOrUpdateModel()">
11
+ 确定
12
+ </el-button>
13
+ <el-button @click="crudContext.editDialog.visible = false">
14
+ 取消
15
+ </el-button>
16
+ </template>
17
+ </el-dialog>
18
+
19
+ </template>
20
+
21
+ <script>
22
+ import {useCrudContext} from "../../index.js";
23
+
24
+ export default {
25
+ name: "crud-edit-dialog",
26
+ setup() {
27
+ const crudContext = useCrudContext();
28
+
29
+ return {crudContext};
30
+ }
31
+ };
32
+ </script>
33
+
34
+ <style scoped>
35
+
36
+ </style>
@@ -0,0 +1,28 @@
1
+ <template>
2
+ <el-form ref="scxCreateAndUpdateFormRef" :model="crudContext.temp" inline label-position="right"
3
+ label-width="150px">
4
+ <slot></slot>
5
+ </el-form>
6
+ </template>
7
+
8
+ <script>
9
+ import {ref} from "vue";
10
+ import {useCrudContext} from "../../index.js";
11
+
12
+ export default {
13
+ name: "crud-edit-form",
14
+ setup() {
15
+ const scxCreateAndUpdateFormRef = ref(null);
16
+ const crudContext = useCrudContext();
17
+ crudContext.scxCreateAndUpdateFormRef = scxCreateAndUpdateFormRef;
18
+ return {
19
+ crudContext,
20
+ scxCreateAndUpdateFormRef
21
+ };
22
+ },
23
+ };
24
+ </script>
25
+
26
+ <style scoped>
27
+
28
+ </style>
@@ -0,0 +1,28 @@
1
+ <template>
2
+
3
+ <el-button :loading="crudContext.editDialog.confirmButtonLoading" type="primary"
4
+ @click="crudContext.createOrUpdateModel()">
5
+ 确定
6
+ </el-button>
7
+
8
+ <el-button @click="crudContext.editDialog.visible = false">
9
+ 取消
10
+ </el-button>
11
+
12
+ </template>
13
+
14
+ <script>
15
+ import {useCrudContext} from "../../index.js";
16
+
17
+ export default {
18
+ name: "crud-form-footer",
19
+ setup() {
20
+ const crudContext = useCrudContext();
21
+ return {crudContext};
22
+ }
23
+ };
24
+ </script>
25
+
26
+ <style scoped>
27
+
28
+ </style>
@@ -0,0 +1,51 @@
1
+ <template>
2
+
3
+ <el-pagination :background="true" :currentPage="crudContext.pagination.currentPage"
4
+ :page-size="crudContext.pagination.pageSize"
5
+ :page-sizes="[10,20,50,100]"
6
+ :total="crudContext.total"
7
+ layout='total, sizes, prev, pager, next, jumper'
8
+ @current-change="handleCurrentChange"
9
+ @size-change="handleSizeChange"/>
10
+
11
+ </template>
12
+
13
+ <script>
14
+ import {useCrudContext} from "../../index.js";
15
+
16
+ export default {
17
+ name: "crud-pagination",
18
+ setup() {
19
+
20
+ const crudContext = useCrudContext();
21
+
22
+ /**
23
+ * 页码数量发生变化
24
+ * @param val 变化后的数量
25
+ */
26
+ function handleCurrentChange(val) {
27
+ crudContext.pagination.currentPage = val;
28
+ crudContext.getList();
29
+ }
30
+
31
+ /**
32
+ * 每页数量发生变化
33
+ * @param val 变化后的数量
34
+ */
35
+ function handleSizeChange(val) {
36
+ crudContext.pagination.pageSize = val;
37
+ crudContext.getList();
38
+ }
39
+
40
+ return {
41
+ crudContext,
42
+ handleCurrentChange,
43
+ handleSizeChange
44
+ };
45
+ }
46
+ };
47
+ </script>
48
+
49
+ <style scoped>
50
+
51
+ </style>
@@ -0,0 +1,19 @@
1
+ <template>
2
+ <el-button circle type="warning" @click="crudContext.resetWhere().getList()">
3
+ <scx-icon icon="outlined-arrow-left"/>
4
+ </el-button>
5
+ </template>
6
+ <script>
7
+ import {useCrudContext} from "../../index.js";
8
+
9
+ export default {
10
+ name: "crud-reset-button",
11
+ setup() {
12
+ const crudContext = useCrudContext();
13
+ return {crudContext};
14
+ }
15
+ };
16
+ </script>
17
+ <style scoped>
18
+
19
+ </style>
@@ -0,0 +1,25 @@
1
+ <template>
2
+
3
+ <el-button round type="primary" @click="crudContext.handleQuery()">
4
+ <scx-icon icon="outlined-search"/>
5
+ <span>搜索</span>
6
+ </el-button>
7
+
8
+ </template>
9
+
10
+ <script>
11
+ import {useCrudContext} from "../../index.js";
12
+
13
+ export default {
14
+ name: "crud-search-button",
15
+ setup() {
16
+ const crudContext = useCrudContext();
17
+
18
+ return {crudContext};
19
+ }
20
+ };
21
+ </script>
22
+
23
+ <style scoped>
24
+
25
+ </style>
@@ -0,0 +1,31 @@
1
+ <template>
2
+ <el-popconfirm title="确定删除此条数据 ?" @confirm="crudContext.deleteOne(data)">
3
+ <template #reference>
4
+ <el-button :disabled="disabled" size="small" type="danger">删除</el-button>
5
+ </template>
6
+ </el-popconfirm>
7
+ </template>
8
+
9
+ <script>
10
+ import {useCrudContext} from "../../index.js";
11
+
12
+ export default {
13
+ name: "crud-table-delete-button",
14
+ props: {
15
+ data: {
16
+ required: true
17
+ },
18
+ disabled: {
19
+ default: false
20
+ }
21
+ },
22
+ setup() {
23
+ const crudContext = useCrudContext();
24
+ return {crudContext};
25
+ }
26
+ };
27
+ </script>
28
+
29
+ <style scoped>
30
+
31
+ </style>
@@ -0,0 +1,26 @@
1
+ <template>
2
+ <el-button size="small" type="primary" @click="crudContext.handleUpdate(data)">
3
+ 编辑
4
+ </el-button>
5
+ </template>
6
+
7
+ <script>
8
+ import {useCrudContext} from "../../index.js";
9
+
10
+ export default {
11
+ name: "crud-table-edit-button",
12
+ props: {
13
+ data: {
14
+ required: true
15
+ }
16
+ },
17
+ setup() {
18
+ const crudContext = useCrudContext();
19
+ return {crudContext};
20
+ }
21
+ };
22
+ </script>
23
+
24
+ <style scoped>
25
+
26
+ </style>
@@ -0,0 +1,131 @@
1
+ <template>
2
+
3
+ <el-table ref="scxTableRef" v-loading="crudContext.tableLoading" :data="crudContext.tableBody"
4
+ :highlight-current-row="true"
5
+ border
6
+ class="crud-table"
7
+ max-height="600"
8
+ row-key="id"
9
+ stripe
10
+ @select="(a)=>crudContext.tableSelect(a)"
11
+ @selectAll="(a)=>crudContext.tableSelectAll(a)"
12
+ @sort-change="handleSortChange"
13
+ @selection-change="(a)=>crudContext.handleSelectionChange(a)"
14
+ @row-contextmenu="handleRowContextMenu">
15
+ <el-table-column :reserve-selection="true" type="selection" width="55"/>
16
+ <slot></slot>
17
+ </el-table>
18
+
19
+ </template>
20
+
21
+ <script>
22
+ import {useCrudContext} from "../../index.js";
23
+ import {ref} from "vue";
24
+ import {showContextMenu} from "@scx-js/scx-ui";
25
+
26
+ export default {
27
+ name: "crud-table",
28
+ setup() {
29
+ const scxTableRef = ref(null);
30
+ const crudContext = useCrudContext();
31
+
32
+ crudContext.scxTableRef = scxTableRef;
33
+
34
+ function handleSortChange(column) {
35
+ const sortTypeMap = {
36
+ ascending: "ASC",
37
+ descending: "DESC"
38
+ };
39
+ crudContext.orderBy.fieldName = column.prop;
40
+ crudContext.orderBy.sortType = column.order !== null ? sortTypeMap[column.order] : null;
41
+ crudContext.getList();
42
+ }
43
+
44
+ function handleRowContextMenu(row, column, event) {
45
+ scxTableRef.value.setCurrentRow(row);
46
+ event.preventDefault();
47
+ openMenu(row, event);
48
+ }
49
+
50
+ function previousPage() {
51
+ //页面减 1
52
+ crudContext.pagination.currentPage += -1;
53
+ //如果小于 1 证明当前页面是 第一页 不做查询操作 用于减少后台并发量
54
+ if (crudContext.pagination.currentPage < 1) {
55
+ crudContext.pagination.currentPage = 1;
56
+ } else {
57
+ //否则执行查询方法
58
+ crudContext.getList();
59
+ }
60
+ }
61
+
62
+ function nextPage() {
63
+ crudContext.pagination.currentPage += 1;
64
+ crudContext.getList();
65
+ }
66
+
67
+ const openMenu = (row, e) => showContextMenu(e, [
68
+ {
69
+ label: "刷新",
70
+ callback: (close) => {
71
+ crudContext.getList();
72
+ close();
73
+ }
74
+ },
75
+ {
76
+ label: "编辑",
77
+ callback: (close) => {
78
+ crudContext.handleUpdate(row);
79
+ close();
80
+ }
81
+ },
82
+ {
83
+ label: "删除此条",
84
+ callback: (close) => {
85
+ crudContext.deleteOne(row);
86
+ close();
87
+ }
88
+ },
89
+ {
90
+ label: "删除选中",
91
+ callback: (close) => {
92
+ crudContext.batchDelete();
93
+ close();
94
+ }
95
+ },
96
+ {
97
+ label: "上一页",
98
+ callback: (close) => {
99
+ previousPage();
100
+ close();
101
+ }
102
+ },
103
+ {
104
+ label: "下一页",
105
+ callback: (close) => {
106
+ nextPage();
107
+ close();
108
+ }
109
+ }
110
+ ]);
111
+
112
+ return {
113
+ crudContext,
114
+ scxTableRef,
115
+ handleSortChange,
116
+ handleRowContextMenu
117
+ };
118
+ }
119
+ };
120
+ </script>
121
+
122
+ <style>
123
+ .crud-table {
124
+ --el-table-current-row-bg-color: var(--scx-theme-secondary);
125
+ --el-table-row-hover-bg-color: var(--scx-theme-bg);
126
+ }
127
+
128
+ .el-table__body tr.current-row > td.el-table__cell {
129
+ background-color: var(--el-table-current-row-bg-color) !important;
130
+ }
131
+ </style>
@@ -0,0 +1,46 @@
1
+ /*主内容*/
2
+ .crud {
3
+ display: flex;
4
+ flex-direction: column;
5
+ padding: 5px;
6
+ height: 100%;
7
+ overflow: auto;
8
+ box-sizing: border-box;
9
+ row-gap: 5px;
10
+ }
11
+
12
+ /*头部*/
13
+ .crud-header {
14
+ display: flex;
15
+ justify-content: space-between;
16
+ }
17
+
18
+ /*头部分栏布局*/
19
+ .crud-header-left,
20
+ .crud-header-right,
21
+ .crud-footer {
22
+ display: flex;
23
+ flex-wrap: wrap;
24
+ align-content: flex-start;
25
+ align-items: center;
26
+ column-gap: 5px;
27
+ row-gap: 5px;
28
+ }
29
+
30
+ /*头部左侧所有子元素的样式*/
31
+ .crud-header-left > *,
32
+ .crud-header-right > *,
33
+ .crud-footer > * {
34
+ margin-left: 0 !important;
35
+ margin-right: 0 !important;
36
+ }
37
+
38
+ /*头部右侧容器的子元素排列类型*/
39
+ .crud-header-right {
40
+ justify-content: flex-end;
41
+ }
42
+
43
+ /* 主区域 */
44
+ .crud-main {
45
+
46
+ }
@@ -0,0 +1,37 @@
1
+ <template>
2
+ <div class="crud">
3
+ <!-- 头部 -->
4
+ <header v-if="$slots['header-left']||$slots['header-right']" class="crud-header">
5
+ <!-- 头部左侧 (一般放操作项 如 : 添加按钮 , 导出按钮) -->
6
+ <div class="crud-header-left">
7
+ <slot name="header-left"/>
8
+ </div>
9
+ <!-- 头部右侧 (一般放查询项) -->
10
+ <div class="crud-header-right">
11
+ <slot name="header-right"/>
12
+ </div>
13
+ </header>
14
+
15
+ <!-- 主内容区 一般放一个表格 -->
16
+ <main v-if="$slots['main']" class="crud-main">
17
+ <slot name="main"/>
18
+ </main>
19
+
20
+ <!-- 底部内容区 一般放分页或批量删除按钮 (远离顶部防止误操作) -->
21
+ <footer v-if="$slots['footer']" class="crud-footer">
22
+ <slot name="footer"/>
23
+ </footer>
24
+
25
+ <!-- 自定义的内容 -->
26
+ <slot/>
27
+
28
+ </div>
29
+ </template>
30
+
31
+ <script>
32
+ import "./index.css";
33
+
34
+ export default {
35
+ name: "crud"
36
+ };
37
+ </script>