index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. <template>
  2. <el-scrollbar>
  3. <div class="crud-demo">
  4. <el-tabs v-model="active" type="card" @tab-change="onTabChange">
  5. <el-tab-pane v-for="(a, ai) in list" :key="ai" :label="a.title" :name="a.title">
  6. <div v-for="(b, bi) in a.children" :key="bi" class="group">
  7. <p class="label"># {{ b.label }}</p>
  8. <el-row :gutter="10">
  9. <el-col
  10. v-for="(c, ci) in b.children"
  11. :key="ci"
  12. :xs="24"
  13. :sm="12"
  14. :md="8"
  15. :lg="6"
  16. >
  17. <component :is="c" />
  18. </el-col>
  19. </el-row>
  20. </div>
  21. </el-tab-pane>
  22. </el-tabs>
  23. </div>
  24. </el-scrollbar>
  25. </template>
  26. <script lang="ts" setup name="demo-crud">
  27. import { ref, onActivated } from 'vue';
  28. import CrudBase from './components/crud/base.vue';
  29. import CrudAll from './components/crud/all.vue';
  30. import CrudDict from './components/crud/dict.vue';
  31. import CrudEvent from './components/crud/event.vue';
  32. import CrudService from './components/crud/service.vue';
  33. import FormOpen from './components/form/open.vue';
  34. import FormConfig from './components/form/config.vue';
  35. import FormRequired from './components/form/required.vue';
  36. import FormLayout from './components/form/layout.vue';
  37. import FormOptions from './components/form/options.vue';
  38. import FormHidden from './components/form/hidden.vue';
  39. import FormDisabled from './components/form/disabled.vue';
  40. import FormEvent from './components/form/event.vue';
  41. import FormGroup from './components/form/group.vue';
  42. import FormChildren from './components/form/children.vue';
  43. import FormCrud from './components/form/crud.vue';
  44. import FormRules from './components/form/rules.vue';
  45. import FormComponent from './components/form/component/index.vue';
  46. import FormPlugin from './components/form/plugin/index.vue';
  47. import TableBase from './components/table/base.vue';
  48. import TableFormatter from './components/table/formatter.vue';
  49. import TableOp from './components/table/op.vue';
  50. import TableSearch from './components/table/search.vue';
  51. import TableSelection from './components/table/selection.vue';
  52. import TableSlot from './components/table/slot.vue';
  53. import TableSummary from './components/table/summary.vue';
  54. import TableHidden from './components/table/hidden.vue';
  55. import TableChildren from './components/table/children.vue';
  56. import TableContextMenu from './components/table/context-menu.vue';
  57. import TableDict from './components/table/dict.vue';
  58. import TableSpanMethod from './components/table/span-method.vue';
  59. import TableColumnCustom from './components/table/column-custom.vue';
  60. import TableComponent from './components/table/component/index.vue';
  61. import TablePlugin from './components/table/plugin/index.vue';
  62. import UpsertBase from './components/upsert/base.vue';
  63. import UpsertEvent from './components/upsert/event.vue';
  64. import UpsertMode from './components/upsert/mode.vue';
  65. import UpsertHook from './components/upsert/hook/index.vue';
  66. import SearchBase from './components/search/base.vue';
  67. import SearchCustom from './components/search/custom.vue';
  68. import SearchLayout from './components/search/layout.vue';
  69. import AdvSearchBase from './components/adv-search/base.vue';
  70. import AdvSearchCustom from './components/adv-search/custom.vue';
  71. import OtherTsx from './components/other/tsx';
  72. import OtherTips from './components/other/tips.vue';
  73. import { useCool } from '/@/cool';
  74. const { route, router } = useCool();
  75. const active = ref();
  76. const list = [
  77. {
  78. title: 'cl-crud',
  79. children: [
  80. {
  81. label: '基础',
  82. children: [CrudBase, CrudService, CrudDict, CrudEvent]
  83. },
  84. {
  85. label: '高级',
  86. children: [CrudAll]
  87. }
  88. ]
  89. },
  90. {
  91. title: 'cl-table',
  92. children: [
  93. {
  94. label: '基础',
  95. children: [
  96. TableBase,
  97. TableFormatter,
  98. TableOp,
  99. TableSearch,
  100. TableSelection,
  101. TableSlot,
  102. TableDict,
  103. TableHidden,
  104. TableContextMenu,
  105. TableSummary,
  106. TableSpanMethod,
  107. TableChildren
  108. ]
  109. },
  110. {
  111. label: '高级',
  112. children: [TableColumnCustom, TableComponent, TablePlugin]
  113. }
  114. ]
  115. },
  116. {
  117. title: 'cl-upsert',
  118. children: [
  119. {
  120. label: '基础',
  121. children: [UpsertBase, UpsertEvent, UpsertMode]
  122. },
  123. {
  124. label: '高级',
  125. children: [UpsertHook]
  126. }
  127. ]
  128. },
  129. {
  130. title: 'cl-form',
  131. children: [
  132. {
  133. label: '基础',
  134. children: [
  135. FormOpen,
  136. FormConfig,
  137. FormRequired,
  138. FormLayout,
  139. FormOptions,
  140. FormHidden,
  141. FormDisabled,
  142. FormEvent,
  143. FormGroup,
  144. FormChildren,
  145. FormCrud
  146. ]
  147. },
  148. {
  149. label: '高级',
  150. children: [FormRules, FormComponent, FormPlugin]
  151. }
  152. ]
  153. },
  154. {
  155. title: 'cl-search',
  156. children: [
  157. {
  158. label: '基础',
  159. children: [SearchBase, SearchCustom, SearchLayout]
  160. }
  161. ]
  162. },
  163. {
  164. title: 'cl-adv-search',
  165. children: [
  166. {
  167. label: '基础',
  168. children: [AdvSearchBase, AdvSearchCustom]
  169. }
  170. ]
  171. },
  172. {
  173. title: 'other',
  174. children: [
  175. {
  176. label: '高级',
  177. children: [OtherTsx, OtherTips]
  178. }
  179. ]
  180. }
  181. ];
  182. function onTabChange(val: any) {
  183. router.replace({
  184. query: {
  185. key: val
  186. }
  187. });
  188. }
  189. onActivated(() => {
  190. const { key } = route.query;
  191. active.value = (key || 'cl-crud') as string;
  192. });
  193. </script>
  194. <style lang="scss" scoped>
  195. .el-scrollbar {
  196. background-color: var(--el-bg-color);
  197. }
  198. .crud-demo {
  199. padding: 10px;
  200. :deep(.scope) {
  201. border-radius: 8px;
  202. margin-bottom: 10px;
  203. white-space: nowrap;
  204. border: 1px solid var(--el-border-color-light);
  205. cursor: pointer;
  206. transition: all 0.3s;
  207. .h {
  208. display: flex;
  209. align-items: center;
  210. height: 30px;
  211. padding: 10px;
  212. font-size: 12px;
  213. .el-tag {
  214. margin-right: 10px;
  215. }
  216. }
  217. .c {
  218. height: 50px;
  219. padding: 10px;
  220. box-sizing: border-box;
  221. &._svg {
  222. .cl-svg {
  223. margin-right: 15px;
  224. }
  225. }
  226. a {
  227. font-size: 13px;
  228. position: relative;
  229. &:hover {
  230. &:after {
  231. content: '';
  232. width: 100%;
  233. height: 1px;
  234. position: absolute;
  235. bottom: -2px;
  236. left: 0;
  237. background-color: var(--color-primary);
  238. }
  239. }
  240. }
  241. }
  242. .f {
  243. display: flex;
  244. align-items: center;
  245. justify-content: space-between;
  246. height: 30px;
  247. padding: 10px;
  248. font-size: 12px;
  249. .date {
  250. color: #999;
  251. }
  252. }
  253. &:hover {
  254. box-shadow: 0px 0px 10px 1px var(--el-color-info-light-9);
  255. }
  256. }
  257. .group {
  258. margin-bottom: 20px;
  259. .label {
  260. margin-bottom: 10px;
  261. font-size: 15px;
  262. font-weight: bold;
  263. }
  264. }
  265. }
  266. </style>