@ditari/bsui 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 (158) hide show
  1. package/dist/cjs/components/components.cjs.js +1 -1
  2. package/dist/cjs/components/components.d.ts +2 -1
  3. package/dist/cjs/components/form/grid-form/GridForm.cjs.js +1 -0
  4. package/dist/cjs/components/form/grid-form/GridForm.d.ts +2 -0
  5. package/dist/cjs/components/form/index.cjs.js +1 -1
  6. package/dist/cjs/components/form/index.d.ts +8 -1
  7. package/dist/cjs/components/grid/Grid.cjs.js +1 -0
  8. package/dist/cjs/components/grid/Grid.d.ts +23 -0
  9. package/dist/cjs/components/grid/GridItem.cjs.js +1 -0
  10. package/dist/cjs/components/grid/GridItem.d.ts +2 -0
  11. package/dist/cjs/components/grid/index.cjs.js +1 -0
  12. package/dist/cjs/components/grid/index.d.ts +23 -0
  13. package/dist/cjs/components/index.cjs.js +1 -1
  14. package/dist/cjs/components/layout/Breadcrumb.vue.cjs.js +1 -1
  15. package/dist/cjs/components/layout/List.vue.cjs.js +1 -1
  16. package/dist/cjs/components/layout/Main.vue.cjs.js +1 -1
  17. package/dist/cjs/components/layout/Menu.cjs.js +1 -1
  18. package/dist/cjs/components/layout/NavTabs.vue.cjs.js +1 -1
  19. package/dist/cjs/components/layout/Show.vue.cjs.js +1 -1
  20. package/dist/cjs/components/layout/Show.vue.d.ts +11 -0
  21. package/dist/cjs/components/layout/index.d.ts +11 -25
  22. package/dist/cjs/components/table/Table.vue.cjs.js +1 -1
  23. package/dist/cjs/components/table/Table.vue.d.ts +1 -1
  24. package/dist/cjs/components/table/index.d.ts +1 -1
  25. package/dist/cjs/components/theme/index.cjs.js +1 -0
  26. package/dist/cjs/components/theme/index.d.ts +1 -0
  27. package/dist/cjs/hooks/http/index.cjs.js +1 -0
  28. package/dist/cjs/hooks/http/index.d.ts +29 -0
  29. package/dist/cjs/hooks/index.cjs.js +1 -0
  30. package/dist/cjs/hooks/index.d.ts +2 -0
  31. package/dist/cjs/hooks/route/index.cjs.js +1 -0
  32. package/dist/cjs/hooks/route/index.d.ts +9 -0
  33. package/dist/cjs/store/index.cjs.js +1 -0
  34. package/dist/cjs/store/index.d.ts +7 -7
  35. package/dist/cjs/store/modules/Breadcrumb.cjs.js +1 -1
  36. package/dist/cjs/store/modules/Breadcrumb.d.ts +6 -16
  37. package/dist/cjs/store/modules/DataDictionary.cjs.js +1 -1
  38. package/dist/cjs/store/modules/DataDictionary.d.ts +28 -3
  39. package/dist/cjs/store/modules/KeepAlive.cjs.js +1 -1
  40. package/dist/cjs/store/modules/KeepAlive.d.ts +3 -4
  41. package/dist/cjs/store/modules/Menu.cjs.js +1 -1
  42. package/dist/cjs/store/modules/Menu.d.ts +1 -2
  43. package/dist/cjs/store/modules/NavTab.cjs.js +1 -1
  44. package/dist/cjs/store/modules/NavTab.d.ts +3 -4
  45. package/dist/cjs/store/modules/Settings.cjs.js +1 -1
  46. package/dist/cjs/store/modules/Settings.d.ts +23 -9
  47. package/dist/cjs/store/modules/User.cjs.js +1 -1
  48. package/dist/cjs/store/modules/User.d.ts +1 -2
  49. package/dist/cjs/store/types.cjs.js +1 -1
  50. package/dist/cjs/utils/get.cjs.js +1 -0
  51. package/dist/css/grid/style/index.css +1 -0
  52. package/dist/css/index.css +1 -0
  53. package/dist/css/menu/style/index.css +1 -0
  54. package/dist/esm/components/components.d.ts +2 -1
  55. package/dist/esm/components/components.esm.js +10 -7
  56. package/dist/esm/components/form/grid-form/GridForm.d.ts +2 -0
  57. package/dist/esm/components/form/grid-form/GridForm.esm.js +9 -0
  58. package/dist/esm/components/form/index.d.ts +8 -1
  59. package/dist/esm/components/form/index.esm.js +5 -3
  60. package/dist/esm/components/grid/Grid.d.ts +23 -0
  61. package/dist/esm/components/grid/Grid.esm.js +55 -0
  62. package/dist/esm/components/grid/GridItem.d.ts +2 -0
  63. package/dist/esm/components/grid/GridItem.esm.js +15 -0
  64. package/dist/esm/components/grid/index.d.ts +23 -0
  65. package/dist/esm/components/grid/index.esm.js +8 -0
  66. package/dist/esm/components/index.esm.js +16 -13
  67. package/dist/esm/components/layout/Breadcrumb.vue.esm.js +13 -19
  68. package/dist/esm/components/layout/List.vue.esm.js +29 -35
  69. package/dist/esm/components/layout/Main.vue.esm.js +53 -50
  70. package/dist/esm/components/layout/Menu.esm.js +45 -19
  71. package/dist/esm/components/layout/NavTabs.vue.esm.js +27 -27
  72. package/dist/esm/components/layout/Show.vue.d.ts +11 -0
  73. package/dist/esm/components/layout/Show.vue.esm.js +70 -48
  74. package/dist/esm/components/layout/index.d.ts +11 -25
  75. package/dist/esm/components/table/Table.vue.d.ts +1 -1
  76. package/dist/esm/components/table/Table.vue.esm.js +2 -2
  77. package/dist/esm/components/table/index.d.ts +1 -1
  78. package/dist/esm/components/theme/index.d.ts +1 -0
  79. package/dist/esm/components/theme/index.esm.js +4 -0
  80. package/dist/esm/hooks/http/index.d.ts +29 -0
  81. package/dist/esm/hooks/http/index.esm.js +52 -0
  82. package/dist/esm/hooks/index.d.ts +2 -0
  83. package/dist/esm/hooks/index.esm.js +6 -0
  84. package/dist/esm/hooks/route/index.d.ts +9 -0
  85. package/dist/esm/hooks/route/index.esm.js +42 -0
  86. package/dist/esm/store/index.d.ts +7 -7
  87. package/dist/esm/store/index.esm.js +16 -0
  88. package/dist/esm/store/modules/Breadcrumb.d.ts +6 -16
  89. package/dist/esm/store/modules/Breadcrumb.esm.js +4 -12
  90. package/dist/esm/store/modules/DataDictionary.d.ts +28 -3
  91. package/dist/esm/store/modules/DataDictionary.esm.js +30 -6
  92. package/dist/esm/store/modules/KeepAlive.d.ts +3 -4
  93. package/dist/esm/store/modules/KeepAlive.esm.js +4 -4
  94. package/dist/esm/store/modules/Menu.d.ts +1 -2
  95. package/dist/esm/store/modules/Menu.esm.js +1 -1
  96. package/dist/esm/store/modules/NavTab.d.ts +3 -4
  97. package/dist/esm/store/modules/NavTab.esm.js +2 -2
  98. package/dist/esm/store/modules/Settings.d.ts +23 -9
  99. package/dist/esm/store/modules/Settings.esm.js +81 -6
  100. package/dist/esm/store/modules/User.d.ts +1 -2
  101. package/dist/esm/store/modules/User.esm.js +4 -1
  102. package/dist/esm/store/types.esm.js +4 -4
  103. package/dist/esm/style.css +1 -274
  104. package/dist/esm/utils/get.esm.js +11 -0
  105. package/dist/style/grid/style/index.scss +61 -0
  106. package/dist/style/index.scss +15 -0
  107. package/dist/style/menu/style/index.scss +18 -0
  108. package/dist/style/theme/theme.scss +1 -0
  109. package/dist/style/theme/variable.scss +21 -0
  110. package/package.json +10 -7
  111. package/src/components/components.ts +4 -0
  112. package/src/components/config/Config.vue +8 -0
  113. package/src/components/form/Form.vue +10 -0
  114. package/src/components/form/grid-form/GridForm.jsx +10 -0
  115. package/src/components/form/index.ts +8 -0
  116. package/src/components/form/style/index.less +0 -0
  117. package/src/components/grid/Grid.tsx +73 -0
  118. package/src/components/grid/GridItem.tsx +15 -0
  119. package/src/components/grid/index.md +4 -0
  120. package/src/components/grid/index.ts +7 -0
  121. package/src/components/grid/style/index.scss +61 -0
  122. package/src/components/index.scss +15 -0
  123. package/src/components/index.ts +31 -0
  124. package/src/components/layout/Breadcrumb.vue +119 -0
  125. package/src/components/layout/Header.vue +0 -0
  126. package/src/components/layout/Layout.jsx +24 -0
  127. package/src/components/layout/List.vue +159 -0
  128. package/src/components/layout/Main.vue +187 -0
  129. package/src/components/layout/Menu.jsx +96 -0
  130. package/src/components/layout/NavTabs.vue +192 -0
  131. package/src/components/layout/Show.vue +157 -0
  132. package/src/components/layout/index.ts +19 -0
  133. package/src/components/menu/Menu.jsx +94 -0
  134. package/src/components/menu/style/index.scss +18 -0
  135. package/src/components/select/Select.vue +85 -0
  136. package/src/components/table/Field.vue +49 -0
  137. package/src/components/table/Table.vue +391 -0
  138. package/src/components/table/index.md +1 -0
  139. package/src/components/table/index.ts +5 -0
  140. package/src/components/theme/index.ts +1 -0
  141. package/src/components/theme/theme.scss +1 -0
  142. package/src/components/theme/variable.scss +21 -0
  143. package/src/hooks/http/index.ts +107 -0
  144. package/src/hooks/index.ts +2 -0
  145. package/src/hooks/route/index.ts +84 -0
  146. package/src/store/index.ts +7 -0
  147. package/src/store/modules/Breadcrumb.ts +25 -0
  148. package/src/store/modules/DataDictionary.ts +49 -0
  149. package/src/store/modules/KeepAlive.ts +47 -0
  150. package/src/store/modules/Menu.ts +24 -0
  151. package/src/store/modules/NavTab.ts +81 -0
  152. package/src/store/modules/Settings.ts +120 -0
  153. package/src/store/modules/User.ts +23 -0
  154. package/src/store/types.ts +15 -0
  155. package/src/tsconfig.json +16 -0
  156. package/src/utils/get.ts +15 -0
  157. package/src/utils/index.ts +2 -0
  158. package/src/utils/install.ts +12 -0
@@ -0,0 +1,192 @@
1
+ <script setup lang="ts">
2
+ /**
3
+ * 标签组件
4
+ */
5
+ import { computed, Ref, watch } from "vue";
6
+ import { useRoute, useRouter } from "vue-router";
7
+ import { CloseOutlined } from "@ant-design/icons-vue";
8
+ import { useNavTabsStore, useKeepAliveStore } from "../../store";
9
+ import { INavTab } from "../../store/modules/NavTab";
10
+ import { storeToRefs } from "pinia";
11
+
12
+ const route = useRoute();
13
+ const router = useRouter();
14
+
15
+ const navStore = useNavTabsStore();
16
+ const keepAliveStore = useKeepAliveStore();
17
+
18
+ //标签列表
19
+ const navTabs: Ref<INavTab[]> = computed(() => navStore.getList);
20
+ //激活的标签 转化成Ref对象 不然v-model无法操作更新
21
+ const { activeKey } = storeToRefs(navStore);
22
+
23
+ //首次进入页面或者刷新的时候执行
24
+ setNavTabs();
25
+
26
+ watch(
27
+ () => route.path,
28
+ () => {
29
+ //TODO 需要优化 确保只有未打开过的标签 进入保存
30
+ setNavTabs();
31
+ }
32
+ );
33
+
34
+ //设置标签
35
+ function setNavTabs() {
36
+ // 保存标签
37
+ navStore.save(route);
38
+ // 设置激活的标签
39
+ navStore.setActiveKey(route.path);
40
+ keepAliveStore.save(route);
41
+ }
42
+
43
+ /**
44
+ * 切换标签
45
+ * @param nav
46
+ */
47
+ const onClick = (key: string) => {
48
+ if (key !== route.path) {
49
+ // 匹配打开的标签路由数据
50
+ const rs = navTabs.value.filter((item: any) => item.path === key)[0];
51
+ // 打开路由
52
+ router.push({
53
+ path: rs.path,
54
+ query: rs.query,
55
+ params: rs.params
56
+ });
57
+ }
58
+ };
59
+
60
+ /**
61
+ * 关闭标签
62
+ * @param $event
63
+ * @param targetKey
64
+ */
65
+ const onClose = ($event: any, key: string) => {
66
+ const rs = navTabs.value.filter((item) => item.path === key)[0];
67
+ //阻止冒泡
68
+ $event.stopPropagation();
69
+ // 删除标签
70
+ navStore.deleteTabs(key);
71
+ // 重新push已打开的路由
72
+ router.push(navTabs.value[navTabs.value.length - 1].fullPath);
73
+
74
+ //根据name 删除缓存的组件
75
+ if (rs.name) {
76
+ keepAliveStore.deleteKeepAlive(rs.name);
77
+ }
78
+ };
79
+ </script>
80
+ <script lang="ts">
81
+ export default {
82
+ name: "DNavTabs"
83
+ };
84
+ </script>
85
+ <template>
86
+ <div class="ditari-nav">
87
+ <a-tabs v-model:activeKey="activeKey" type="card" @tabClick="onClick">
88
+ <a-tab-pane v-for="item in navTabs" :key="item.path">
89
+ <template #tab>
90
+ <div class="tab-item" :class="{ active: activeKey === item.path }">
91
+ {{ item.meta.title }}
92
+ </div>
93
+ <CloseOutlined @click="onClose($event, item.fullPath)" />
94
+ </template>
95
+ </a-tab-pane>
96
+ </a-tabs>
97
+ </div>
98
+ </template>
99
+ <style lang="scss">
100
+ .ditari-nav {
101
+ background: #f0f2f5;
102
+ .ant-tabs-nav {
103
+ margin: 0;
104
+ }
105
+ .ant-tabs-content-holder {
106
+ display: none;
107
+ }
108
+ .ant-tabs-tab {
109
+ position: relative;
110
+ margin-left: 0 !important;
111
+ border: 0 !important;
112
+ transition: none !important;
113
+ border-radius: 10px 10px 0 0 !important;
114
+ &:not(.ant-tabs-tab-active) {
115
+ background: transparent;
116
+ }
117
+ &:hover {
118
+ &:not(.ant-tabs-tab-active) {
119
+ background: #e9e9e9;
120
+ }
121
+ }
122
+
123
+ .ant-tabs-tab-btn {
124
+ display: flex;
125
+ align-items: center;
126
+ }
127
+ .anticon {
128
+ margin-right: 0;
129
+ margin-left: 20px;
130
+ &:hover {
131
+ font-weight: bold;
132
+ }
133
+ }
134
+ }
135
+ .ant-tabs-nav-wrap {
136
+ padding: 4px 8px 0;
137
+ }
138
+
139
+ .ant-tabs-tab::before,
140
+ .ant-tabs-tab::after {
141
+ position: absolute;
142
+ bottom: 0;
143
+ content: "";
144
+ width: 20px;
145
+ height: 20px;
146
+ border-radius: 100%;
147
+ box-shadow: 0 0 0 40px transparent;
148
+ }
149
+ .ant-tabs-tab::before {
150
+ left: -20px;
151
+ clip-path: inset(50% -10px 0 50%);
152
+ }
153
+ .ant-tabs-tab::after {
154
+ right: -20px;
155
+ clip-path: inset(50% 50% 0 -10px);
156
+ }
157
+
158
+ .ant-tabs-tab:hover::before,
159
+ .ant-tabs-tab:hover::after {
160
+ box-shadow: 0 0 0 30px #e9e9e9;
161
+ }
162
+
163
+ .ant-tabs-tab.ant-tabs-tab-active::before,
164
+ .ant-tabs-tab.ant-tabs-tab-active::after {
165
+ z-index: 10;
166
+ box-shadow: 0 0 0 30px #fff;
167
+ }
168
+
169
+ .tab-item-dividers {
170
+ position: absolute;
171
+ z-index: 0;
172
+ height: 14px;
173
+ top: 50%;
174
+ left: 0;
175
+ right: 0;
176
+ margin-top: -7px;
177
+ &::before {
178
+ content: "";
179
+ display: block;
180
+ position: absolute;
181
+ top: 0;
182
+ left: 1px;
183
+ bottom: 0;
184
+ width: 1px;
185
+ opacity: 1;
186
+ background-color: red;
187
+ transition: opacity 0.2s ease, background-color 0.3s;
188
+ z-index: 2;
189
+ }
190
+ }
191
+ }
192
+ </style>
@@ -0,0 +1,157 @@
1
+ <script setup lang="ts">
2
+ /**
3
+ * 详情/新增/编辑组件
4
+ */
5
+ import { useSlots, watch } from "vue";
6
+ import { useRoute, useRouter } from "vue-router";
7
+ import { LeftOutlined } from "@ant-design/icons-vue";
8
+ import { useScrollLock, useWindowScroll } from "@vueuse/core";
9
+ import { useNavTabsStore } from "../../store/modules/NavTab";
10
+ import { useSettingsStore } from "../../store/modules/Settings";
11
+
12
+ import { storeToRefs } from "pinia";
13
+
14
+ interface Props {
15
+ // 点击返回的时候是否关闭标签
16
+ close?: boolean;
17
+ // 请求数据的时候开启加载效果
18
+ loading?: boolean;
19
+ }
20
+
21
+ const props = withDefaults(defineProps<Props>(), {
22
+ close: false,
23
+ loading: false
24
+ });
25
+
26
+ const router = useRouter();
27
+ const route = useRoute();
28
+ const slots = useSlots();
29
+
30
+ const navTabStore = useNavTabsStore();
31
+ const settingsStore = useSettingsStore();
32
+
33
+ const { refresh } = storeToRefs(settingsStore);
34
+
35
+ const contentStyle = {
36
+ padding: `10px 10px ${slots.footer ? "70px" : "10px"} 10px`
37
+ };
38
+ /**
39
+ * 点击返回
40
+ */
41
+ const onBack = () => {
42
+ if (props.close) {
43
+ // 返回关闭标签
44
+ navTabStore.deleteTabs(route.path);
45
+ router.go(-1);
46
+ } else {
47
+ // 不关闭标签
48
+ router.go(-1);
49
+ }
50
+ };
51
+
52
+ /**
53
+ * 对外暴露方法 调用后关闭标签 并且出发List组件刷新动作
54
+ */
55
+ const onRefresh = () => {
56
+ refresh.value = true;
57
+ navTabStore.deleteTabs(route.path);
58
+ router.go(-1);
59
+ };
60
+
61
+ /**
62
+ * 监听屏幕滚动,滚动大于0的时候给a-page-header组件添加阴影
63
+ */
64
+ const { y } = useWindowScroll();
65
+ // 锁定屏幕
66
+ const isLocked = useScrollLock(document.body);
67
+
68
+ watch(
69
+ () => props.loading,
70
+ (val) => {
71
+ isLocked.value = val;
72
+ }
73
+ );
74
+
75
+ const delayTime = 200;
76
+ defineExpose({
77
+ refresh: onRefresh
78
+ });
79
+ </script>
80
+ <script lang="ts">
81
+ export default {
82
+ name: "DShowLayout"
83
+ };
84
+ </script>
85
+ <template>
86
+ <div class="ditari-show-layout">
87
+ <a-spin
88
+ tip="正在处理..."
89
+ :spinning="loading"
90
+ :delay="delayTime"
91
+ size="large"
92
+ >
93
+ <a-page-header
94
+ class="ditari-page-header"
95
+ :class="{ active: y > 0 }"
96
+ :ghost="false"
97
+ @back="onBack"
98
+ >
99
+ <template #backIcon>
100
+ <LeftOutlined />
101
+ </template>
102
+ <template #title>{{ $route.meta.title }} </template>
103
+ <template #subTitle>
104
+ <slot name="subTitle"></slot>
105
+ </template>
106
+ <template #extra>
107
+ <slot name="extra"></slot>
108
+ </template>
109
+ </a-page-header>
110
+ <div class="ditari-show-content" :style="contentStyle">
111
+ <slot></slot>
112
+ </div>
113
+ <div v-if="$slots.footer" class="ditari-show-footer">
114
+ <slot name="footer"></slot>
115
+ </div>
116
+ </a-spin>
117
+ </div>
118
+ </template>
119
+ <style lang="scss">
120
+ $box-shadow-color: #e0e0e0;
121
+ .ditari-show-layout {
122
+ position: relative;
123
+ .ant-card {
124
+ margin-bottom: 10px;
125
+ .ant-card-head {
126
+ padding: 10px 24px;
127
+ .ant-card-head-title {
128
+ padding: 0;
129
+ }
130
+ }
131
+ &:last-child {
132
+ margin-bottom: 0;
133
+ }
134
+ }
135
+ .ditari-page-header {
136
+ position: sticky;
137
+ top: 84px;
138
+ z-index: 1;
139
+ padding: 4px 24px;
140
+ transition: all 0.3s;
141
+ &.active {
142
+ box-shadow: 1px 5px 20px 2px $box-shadow-color;
143
+ }
144
+ }
145
+ .ditari-show-content {
146
+ }
147
+ .ditari-show-footer {
148
+ position: fixed;
149
+ right: 0;
150
+ bottom: 0;
151
+ left: 200px;
152
+ padding: 10px;
153
+ background: #fff;
154
+ box-shadow: 0px 0px 5px 3px $box-shadow-color;
155
+ }
156
+ }
157
+ </style>
@@ -0,0 +1,19 @@
1
+ import { withInstall } from "../../utils/index";
2
+ import List from "./List.vue";
3
+ import Main from "./Main.vue";
4
+
5
+ import NavTabs from "./NavTabs.vue";
6
+
7
+ import Show from "./Show.vue";
8
+
9
+ export const DList = withInstall(List);
10
+ export const DMain = withInstall(Main);
11
+ export const DNavTabs = withInstall(NavTabs);
12
+ export const DShow = withInstall(Show);
13
+
14
+ // export default {
15
+ // DList,
16
+ // DMain,
17
+ // DNavTabs,
18
+ // DShow
19
+ // };
@@ -0,0 +1,94 @@
1
+ import { defineComponent, h, ref, resolveComponent } from "vue";
2
+ import { useMenuStore } from "../../store";
3
+
4
+ export default defineComponent({
5
+ name: "DMenu",
6
+ setup() {
7
+ const { list } = useMenuStore();
8
+ // 当前展开的菜单
9
+ const openKeys = ref(["/labelList", "/label"]);
10
+ // 当前选中的菜单
11
+ const selectedKeys = ref(["/label"]);
12
+
13
+ /**
14
+ * 监听菜单点击事件
15
+ * @param item
16
+ * @param key
17
+ * @param keyPath
18
+ */
19
+ const onClick = ({ item, key, keyPath }) => {
20
+ console.log(item, key, keyPath);
21
+ openKeys.value = keyPath;
22
+ selectedKeys.value = [key];
23
+ };
24
+ /**
25
+ * 监听菜单展开事件
26
+ * @param keys
27
+ */
28
+ const openChange = (keys) => {
29
+ //TODO 暂时先不处理
30
+ console.log(keys);
31
+ };
32
+
33
+ // 递归渲染子菜单
34
+ const renderSubMenu = (menuList, parent) => {
35
+ if (!menuList || !menuList.length) {
36
+ return null;
37
+ }
38
+
39
+ return (
40
+ <a-sub-menu>
41
+ {{
42
+ title: () => parent.title,
43
+ default: () => {
44
+ return menuList.map((menu) => (
45
+ <a-menu-item key={menu.url}>{menu.title}</a-menu-item>
46
+ ));
47
+ }
48
+ }}
49
+ </a-sub-menu>
50
+ );
51
+ };
52
+
53
+ return () => (
54
+ <a-menu
55
+ mode="inline"
56
+ v-model:openKeys={openKeys.value}
57
+ v-model:selectedKeys={selectedKeys.value}
58
+ onClick={onClick}
59
+ >
60
+ {list.map((menu) => (
61
+ <a-sub-menu key={menu.url}>
62
+ {{
63
+ title: () => <>{menu.title}</>,
64
+ icon: () => (
65
+ <>
66
+ <span>{menu.icon ? h(resolveComponent(menu.icon)) : undefined}</span>
67
+ </>
68
+ ),
69
+ default: () => {
70
+ if (menu.children && menu.children.length) {
71
+ return menu.children.map((child) => {
72
+ return (
73
+ <>
74
+ {child.children ? (
75
+ renderSubMenu(child.children, menu)
76
+ ) : (
77
+ <a-menu-item key={child.url}>
78
+ {child.title}
79
+ </a-menu-item>
80
+ )}
81
+ </>
82
+ );
83
+ });
84
+ } else {
85
+ return <>无子标签</>;
86
+ }
87
+ }
88
+ }}
89
+ </a-sub-menu>
90
+ ))}
91
+ </a-menu>
92
+ );
93
+ }
94
+ });
@@ -0,0 +1,18 @@
1
+ @import "../../theme/variable.scss";
2
+
3
+ .ditari-menu {
4
+ // 菜单高度 $logo-height 为logo的高度
5
+ height: calc(100vh - $logo-height);
6
+ overflow: scroll;
7
+ &::-webkit-scrollbar {
8
+ width: 0 !important;
9
+ display: none;
10
+ }
11
+ }
12
+
13
+ .ditari-layout {
14
+ background-color: red;
15
+ .ditari-layout-sider {
16
+ background-color: red;
17
+ }
18
+ }
@@ -0,0 +1,85 @@
1
+ <script setup lang="ts">
2
+ import { watch, ref } from "vue";
3
+ import { useDic } from "@dth-doned/hooks";
4
+
5
+ interface Props {
6
+ value: any;
7
+ name: string; //字典名字
8
+ disabled?: boolean;
9
+ placeholder?: string;
10
+ }
11
+
12
+ const props = withDefaults(defineProps<Props>(), {
13
+ value: null,
14
+ name: "",
15
+ disabled: false,
16
+ placeholder: "请填写默认占位符啊!老铁"
17
+ });
18
+
19
+ interface Emits {
20
+ (e: "update:value", value: any): void;
21
+ }
22
+ const emits = defineEmits<Emits>();
23
+
24
+ const { modelValue, data, onSearch, onSelect } = useSelect();
25
+ function useSelect() {
26
+ const { getDic } = useDic();
27
+ const dicData = getDic(props.name);
28
+
29
+ const data = ref(dicData);
30
+ const modelValue = ref(props.value);
31
+
32
+ //监听用户搜索事件
33
+ const onSearch = (value: string) => {
34
+ data.value = dicData.filter((item: any) => {
35
+ return (
36
+ item.value.toLowerCase().indexOf(value.toLowerCase()) !== -1 ||
37
+ item.label.toLowerCase().includes(value.toLowerCase())
38
+ );
39
+ });
40
+ };
41
+
42
+ //监听下拉选择事件
43
+ const onSelect = (value: any) => {
44
+ // 发射选择的数据
45
+ emits("update:value", value);
46
+ };
47
+
48
+ //监听数据变化
49
+ watch(
50
+ () => props.value,
51
+ (val) => {
52
+ modelValue.value = val;
53
+ if (!val) {
54
+ data.value = dicData;
55
+ }
56
+ }
57
+ );
58
+ return {
59
+ data,
60
+ modelValue,
61
+ onSearch,
62
+ onSelect
63
+ };
64
+ }
65
+ </script>
66
+ <script lang="ts">
67
+ export default {
68
+ name: "DSelect"
69
+ };
70
+ </script>
71
+ <template>
72
+ <a-select
73
+ v-model:value="modelValue"
74
+ allow-clear
75
+ show-search
76
+ :filter-option="false"
77
+ :options="data"
78
+ :placeholder="placeholder"
79
+ :disabled="disabled"
80
+ @select="onSelect"
81
+ @search="onSearch"
82
+ >
83
+ </a-select>
84
+ </template>
85
+ <style scoped></style>
@@ -0,0 +1,49 @@
1
+ <script setup lang="ts">
2
+ import { h } from "vue";
3
+ import { Badge } from "ant-design-vue";
4
+ import dayjs from "dayjs";
5
+
6
+ interface Props {
7
+ text: string;
8
+ config: any;
9
+ }
10
+
11
+ const props = withDefaults(defineProps<Props>(), {
12
+ text: "",
13
+ config: {}
14
+ });
15
+
16
+ // const { getText } = useDic();
17
+ const getText = (name: string, text: string): string => {
18
+ return name + text;
19
+ };
20
+
21
+ const render = () => {
22
+ const {
23
+ text,
24
+ config: { type }
25
+ } = props;
26
+
27
+ if (type === "dic") {
28
+ const { name, style } = props.config;
29
+ return h("div", [
30
+ h(Badge, {
31
+ color: style[text] || "#f50"
32
+ }),
33
+ h(
34
+ "span",
35
+ { style: { color: style[text] || "#f50" } },
36
+ getText(name, text)
37
+ )
38
+ ]);
39
+ } else if (type === "date") {
40
+ const { formatter } = props.config;
41
+ const rs =
42
+ text !== "" ? "" : dayjs(text).format(formatter || "YYYY-MM-DD HH:mm:ss");
43
+ return h("span", rs);
44
+ }
45
+ };
46
+ </script>
47
+ <template>
48
+ <render />
49
+ </template>