@fishawack/lab-velocity 2.0.0-beta.3 → 2.0.0-beta.31
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.
- package/README.md +441 -37
- package/_Build/vue/components/basic/Button.vue +1 -1
- package/_Build/vue/components/form/Checkbox.vue +10 -0
- package/_Build/vue/components/form/Select.vue +231 -28
- package/_Build/vue/components/form/Spinner.vue +5 -0
- package/_Build/vue/components/layout/Alert.vue +5 -5
- package/_Build/vue/components/layout/Audit.vue +75 -0
- package/_Build/vue/{modules/AuthModule/components/VBreadcrumbs.vue → components/layout/Breadcrumbs.vue} +4 -4
- package/_Build/vue/{modules/AuthModule/components → components/layout}/Chips.vue +2 -2
- package/_Build/vue/components/layout/Footer.vue +11 -10
- package/_Build/vue/{modules/AuthModule/components/VFormFooter.vue → components/layout/FormFooter.vue} +13 -7
- package/_Build/vue/{modules/AuthModule/components → components/layout}/FormRole.vue +10 -8
- package/_Build/vue/components/layout/Layout.vue +76 -0
- package/_Build/vue/components/layout/Navigation.vue +77 -0
- package/_Build/vue/{modules/AuthModule/components/VPageHeader.vue → components/layout/PageHeader.vue} +7 -2
- package/_Build/vue/components/layout/SideBar.vue +26 -0
- package/_Build/vue/{modules/AuthModule/components/VTable.vue → components/layout/Table.vue} +32 -16
- package/_Build/vue/{modules/AuthModule/components/VTableSorter.vue → components/layout/TableSorter.vue} +68 -43
- package/_Build/vue/components/layout/pageTitle.vue +1 -1
- package/_Build/vue/components/navigation/MenuItem.vue +7 -2
- package/_Build/vue/components/navigation/MenuItemGroup.vue +7 -2
- package/_Build/vue/modules/AuthModule/js/axios.js +19 -0
- package/_Build/vue/modules/AuthModule/js/router.js +28 -88
- package/_Build/vue/modules/AuthModule/js/store.js +15 -6
- package/_Build/vue/modules/AuthModule/{adminRoutes/PCompanies/Children/partials → routes/PCompanies}/form.vue +50 -18
- package/_Build/vue/modules/AuthModule/routes/PCompanies/resource.js +259 -0
- package/_Build/vue/modules/AuthModule/routes/PTeams/resource.js +308 -0
- package/_Build/vue/modules/AuthModule/{adminRoutes/PUsers/Children/partials → routes/PUsers}/form.vue +30 -18
- package/_Build/vue/modules/AuthModule/routes/PUsers/resource.js +215 -0
- package/_Build/vue/modules/AuthModule/routes/account-exists.vue +2 -2
- package/_Build/vue/modules/AuthModule/routes/change-password.vue +23 -24
- package/_Build/vue/modules/AuthModule/routes/container.vue +2 -11
- package/_Build/vue/modules/AuthModule/routes/expired-reset.vue +4 -4
- package/_Build/vue/modules/AuthModule/routes/expired-verification.vue +9 -8
- package/_Build/vue/modules/AuthModule/routes/force-reset.vue +24 -28
- package/_Build/vue/modules/AuthModule/routes/forgot.vue +4 -4
- package/_Build/vue/modules/AuthModule/routes/login.vue +7 -11
- package/_Build/vue/modules/AuthModule/routes/logincallback.vue +2 -4
- package/_Build/vue/modules/AuthModule/routes/loginsso.vue +7 -9
- package/_Build/vue/modules/AuthModule/routes/logout.vue +1 -3
- package/_Build/vue/modules/AuthModule/routes/logoutheadless.vue +1 -3
- package/_Build/vue/modules/AuthModule/routes/register.vue +19 -21
- package/_Build/vue/modules/AuthModule/routes/reset.vue +14 -13
- package/_Build/vue/modules/AuthModule/routes/success-forgot.vue +8 -7
- package/_Build/vue/modules/AuthModule/routes/success-reset.vue +2 -2
- package/_Build/vue/modules/AuthModule/routes/success-verify.vue +1 -3
- package/_Build/vue/modules/AuthModule/routes/verify.vue +11 -14
- package/_Build/vue/modules/resource/Children/create.vue +81 -0
- package/_Build/vue/modules/resource/Children/edit.vue +106 -0
- package/_Build/vue/modules/resource/Children/index.vue +42 -0
- package/_Build/vue/modules/resource/Children/partials/form.vue +59 -0
- package/_Build/vue/modules/resource/Children/show.vue +140 -0
- package/_Build/vue/modules/resource/index.js +494 -0
- package/_Build/vue/modules/resource/parent.vue +63 -0
- package/_base.scss +0 -1
- package/_defaults.scss +2 -13
- package/_variables.scss +9 -4
- package/components/_alert.scss +5 -0
- package/components/_auth.scss +163 -0
- package/components/_basic.scss +55 -0
- package/components/_breadcrumbs.scss +39 -0
- package/components/_button.scss +304 -0
- package/components/_cascader.scss +12 -0
- package/components/_checkbox.scss +41 -0
- package/components/_chip.scss +24 -0
- package/components/_collapse.scss +24 -0
- package/components/_datepicker.scss +53 -0
- package/components/_descriptions.scss +2 -0
- package/components/_footer.scss +47 -0
- package/components/_form.scss +24 -0
- package/components/_header.scss +30 -0
- package/components/_icon.scss +25 -0
- package/components/_inputNumber.scss +22 -0
- package/components/_layout.scss +56 -0
- package/components/_link.scss +44 -0
- package/components/_loader.scss +43 -0
- package/components/_menu.scss +112 -0
- package/components/_modal.scss +24 -0
- package/components/_pageTitle.scss +8 -0
- package/components/_permissionLegend.scss +18 -0
- package/components/_select.scss +29 -0
- package/components/_sidebar.scss +41 -0
- package/components/_switch.scss +14 -0
- package/components/_table.scss +20 -0
- package/components/_tooltip.scss +4 -0
- package/components/_typography.scss +162 -0
- package/components/_upload.scss +15 -0
- package/components/_wysiwyg.scss +7 -0
- package/components/_wysiwyg2.scss +142 -0
- package/index.js +10 -1
- package/package.json +5 -3
- package/vendor.scss +0 -1
- package/_Build/vue/components/layout/sideBar.vue +0 -25
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/Upload/upload.vue +0 -251
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/create.vue +0 -62
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/edit.vue +0 -98
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/index.vue +0 -90
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/show.vue +0 -262
- package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/parent.vue +0 -36
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/create.vue +0 -112
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/edit.vue +0 -103
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/index.vue +0 -112
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/show.vue +0 -120
- package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/parent.vue +0 -36
- /package/_Build/vue/{modules/AuthModule/components → components/layout}/AuthModal.vue +0 -0
- /package/_Build/vue/{modules/AuthModule/components → components/layout}/Chip.vue +0 -0
- /package/_Build/vue/{modules/AuthModule/components/VPasswordValidation.vue → components/layout/PasswordValidation.vue} +0 -0
- /package/_Build/vue/{modules/AuthModule/components/VRoleLegend.vue → components/layout/RoleLegend.vue} +0 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="vel-app">
|
|
3
|
+
<VelHeader class="justify-end-dive">
|
|
4
|
+
<router-link :to="{ name: 'index' }">
|
|
5
|
+
<GSvg
|
|
6
|
+
class="logo"
|
|
7
|
+
style="width: 180px"
|
|
8
|
+
embed
|
|
9
|
+
asis
|
|
10
|
+
:name="$store.state.auth.logo"
|
|
11
|
+
/>
|
|
12
|
+
</router-link>
|
|
13
|
+
<template #links>
|
|
14
|
+
<div class="flex items-center pr">
|
|
15
|
+
<GIcon
|
|
16
|
+
class="icon fill-1 icon--0.5 mr-0.5"
|
|
17
|
+
name="icon-account-circle"
|
|
18
|
+
embed
|
|
19
|
+
asis
|
|
20
|
+
/>
|
|
21
|
+
<span>{{ $store?.state?.auth?.user?.name }}</span>
|
|
22
|
+
</div>
|
|
23
|
+
<VelButton
|
|
24
|
+
class="ml"
|
|
25
|
+
type="primary"
|
|
26
|
+
tag="a"
|
|
27
|
+
round
|
|
28
|
+
:href="`${$root.spaUrl}?authenticated=1`"
|
|
29
|
+
>
|
|
30
|
+
<span v-text="`Access ${$root.appName}`" />
|
|
31
|
+
</VelButton>
|
|
32
|
+
</template>
|
|
33
|
+
</VelHeader>
|
|
34
|
+
<div class="vel-content">
|
|
35
|
+
<VelSideBar>
|
|
36
|
+
<template #navigation>
|
|
37
|
+
<VelNavigation v-bind="$attrs" />
|
|
38
|
+
</template>
|
|
39
|
+
<template #expand>
|
|
40
|
+
<GIcon
|
|
41
|
+
class="icon icon--0.5"
|
|
42
|
+
name="icon-keyboard-tab"
|
|
43
|
+
embed
|
|
44
|
+
asis
|
|
45
|
+
/>
|
|
46
|
+
</template>
|
|
47
|
+
</VelSideBar>
|
|
48
|
+
<main class="vel-main">
|
|
49
|
+
<div class="vel-main__inner">
|
|
50
|
+
<slot />
|
|
51
|
+
</div>
|
|
52
|
+
<VelFooter contact="mailTo:det@avalerehealth.com">
|
|
53
|
+
<GSvg
|
|
54
|
+
class="logo fill-0"
|
|
55
|
+
style="width: 180px"
|
|
56
|
+
embed
|
|
57
|
+
asis
|
|
58
|
+
:name="$store.state.auth.logo"
|
|
59
|
+
/>
|
|
60
|
+
</VelFooter>
|
|
61
|
+
</main>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
</template>
|
|
65
|
+
|
|
66
|
+
<script>
|
|
67
|
+
export default {
|
|
68
|
+
components: {
|
|
69
|
+
VelHeader: require("./Header.vue").default,
|
|
70
|
+
VelSideBar: require("./SideBar.vue").default,
|
|
71
|
+
VelFooter: require("./Footer.vue").default,
|
|
72
|
+
VelNavigation: require("./Navigation.vue").default,
|
|
73
|
+
VelButton: require("../basic/Button.vue").default,
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
</script>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<VMenu>
|
|
3
|
+
<template v-for="(link, lkey) in links" :key="lkey">
|
|
4
|
+
<MenuItem v-if="!link.children" :index="lkey">
|
|
5
|
+
<router-link :to="link.href">
|
|
6
|
+
<GIcon
|
|
7
|
+
class="icon icon--0.5"
|
|
8
|
+
:name="link.icon"
|
|
9
|
+
asis
|
|
10
|
+
embed
|
|
11
|
+
/>
|
|
12
|
+
<span>{{ link.title }}</span>
|
|
13
|
+
</router-link>
|
|
14
|
+
</MenuItem>
|
|
15
|
+
<SubMenu v-else :id="lkey" :index="lkey">
|
|
16
|
+
<template #title>
|
|
17
|
+
<GIcon
|
|
18
|
+
class="icon icon--0.5"
|
|
19
|
+
:name="link.icon"
|
|
20
|
+
asis
|
|
21
|
+
embed
|
|
22
|
+
/>
|
|
23
|
+
<span>{{ link.title }}</span>
|
|
24
|
+
</template>
|
|
25
|
+
<MenuItem
|
|
26
|
+
v-for="(child, cindex) in link.children"
|
|
27
|
+
:key="cindex"
|
|
28
|
+
:index="lkey + '-1-' + cindex"
|
|
29
|
+
>
|
|
30
|
+
<router-link :to="child.href">
|
|
31
|
+
<span>{{ child.title }}</span>
|
|
32
|
+
</router-link>
|
|
33
|
+
</MenuItem>
|
|
34
|
+
</SubMenu>
|
|
35
|
+
</template>
|
|
36
|
+
</VMenu>
|
|
37
|
+
</template>
|
|
38
|
+
|
|
39
|
+
<script>
|
|
40
|
+
export default {
|
|
41
|
+
name: "Navigation",
|
|
42
|
+
|
|
43
|
+
components: {
|
|
44
|
+
VMenu: require("../navigation/Menu.vue").default,
|
|
45
|
+
MenuItem: require("../navigation/MenuItem.vue").default,
|
|
46
|
+
SubMenu: require("../navigation/SubMenu.vue").default,
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
props: {
|
|
50
|
+
links: {
|
|
51
|
+
type: Array,
|
|
52
|
+
default: () => [
|
|
53
|
+
{
|
|
54
|
+
title: "Home",
|
|
55
|
+
href: { name: "index" },
|
|
56
|
+
icon: "icon-home",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
title: "Companies",
|
|
60
|
+
href: { name: "companies.index" },
|
|
61
|
+
icon: "icon-cases",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
title: "Users",
|
|
65
|
+
href: { name: "users.index" },
|
|
66
|
+
icon: "icon-user",
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
title: "Utilities",
|
|
70
|
+
href: { name: "index" },
|
|
71
|
+
icon: "icon-utility",
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
</script>
|
|
@@ -5,7 +5,12 @@
|
|
|
5
5
|
<div
|
|
6
6
|
class="p-1.5 mr-2 border-radius border border-solid border-muted flex items-center justify-center"
|
|
7
7
|
>
|
|
8
|
-
<GIcon
|
|
8
|
+
<GIcon
|
|
9
|
+
class="fill-1 icon--0.5"
|
|
10
|
+
:name="icon"
|
|
11
|
+
embed
|
|
12
|
+
artboard
|
|
13
|
+
/>
|
|
9
14
|
</div>
|
|
10
15
|
</span>
|
|
11
16
|
|
|
@@ -22,7 +27,7 @@
|
|
|
22
27
|
|
|
23
28
|
<script>
|
|
24
29
|
export default {
|
|
25
|
-
name: "
|
|
30
|
+
name: "PageHeader",
|
|
26
31
|
|
|
27
32
|
props: {
|
|
28
33
|
icon: {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="vel-sidebar" :class="{ active: active }">
|
|
3
|
+
<div class="vel-sidebar__inner">
|
|
4
|
+
<div class="vel-sidebar__top">
|
|
5
|
+
<slot name="navigation" />
|
|
6
|
+
</div>
|
|
7
|
+
<div class="vel-sidebar__bottom">
|
|
8
|
+
<button class="vel-sidebar__button" @click="active = !active">
|
|
9
|
+
<slot name="expand"> > </slot>
|
|
10
|
+
</button>
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
export default {
|
|
18
|
+
name: "SideBar",
|
|
19
|
+
|
|
20
|
+
data() {
|
|
21
|
+
return {
|
|
22
|
+
active: true,
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
</script>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<el-table
|
|
3
3
|
:data="$props.data"
|
|
4
|
-
:height="fixedHeight ? 762 :
|
|
4
|
+
:height="fixedHeight ? 762 : undefined"
|
|
5
5
|
style="width: 100%"
|
|
6
6
|
@sort-change="handleSort"
|
|
7
7
|
>
|
|
@@ -13,24 +13,25 @@
|
|
|
13
13
|
<el-table-column
|
|
14
14
|
:width="item.width ?? 'auto'"
|
|
15
15
|
:sortable="!!item.sortable ? 'custom' : false"
|
|
16
|
-
:label="
|
|
16
|
+
:label="
|
|
17
|
+
item.label ||
|
|
18
|
+
item.key[0].toUpperCase() + item.key.slice(1)
|
|
19
|
+
"
|
|
17
20
|
:prop="item.key"
|
|
18
21
|
:show-overflow-tooltip="true"
|
|
19
22
|
>
|
|
20
23
|
<!-- Support a custom render function -->
|
|
21
24
|
<template v-if="item.render" #default="scope">
|
|
22
|
-
{{ item.render(scope.row) }}
|
|
23
|
-
</template>
|
|
24
|
-
|
|
25
|
-
<!-- Support module passed (as a raw component or :is property) -->
|
|
26
|
-
<template v-else-if="item.component" #default="scope">
|
|
27
25
|
<component
|
|
28
26
|
:is="
|
|
29
|
-
item.
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
item.render(
|
|
28
|
+
{
|
|
29
|
+
model: scope.row,
|
|
30
|
+
...additionalInfo,
|
|
31
|
+
},
|
|
32
|
+
this,
|
|
33
|
+
)
|
|
32
34
|
"
|
|
33
|
-
v-bind="item.component.props(scope.row)"
|
|
34
35
|
/>
|
|
35
36
|
</template>
|
|
36
37
|
</el-table-column>
|
|
@@ -47,18 +48,18 @@
|
|
|
47
48
|
v-if="$props.displayShowAction"
|
|
48
49
|
:to="$props.targetAction($props.data[scope.$index])"
|
|
49
50
|
>
|
|
50
|
-
<
|
|
51
|
+
<VelButton size="small" type="primary">
|
|
51
52
|
{{ `View` }}
|
|
52
|
-
</
|
|
53
|
+
</VelButton>
|
|
53
54
|
</router-link>
|
|
54
55
|
<router-link
|
|
55
56
|
v-if="$props.displayEditAction"
|
|
56
57
|
class="ml"
|
|
57
58
|
:to="$props.editAction($props.data[scope.$index])"
|
|
58
59
|
>
|
|
59
|
-
<
|
|
60
|
+
<VelButton size="small">
|
|
60
61
|
{{ `Edit` }}
|
|
61
|
-
</
|
|
62
|
+
</VelButton>
|
|
62
63
|
</router-link>
|
|
63
64
|
</template>
|
|
64
65
|
</el-table-column>
|
|
@@ -67,9 +68,24 @@
|
|
|
67
68
|
</template>
|
|
68
69
|
|
|
69
70
|
<script>
|
|
71
|
+
import { ElTable, ElTableColumn } from "element-plus";
|
|
72
|
+
import VelButton from "../basic/Button.vue";
|
|
73
|
+
|
|
70
74
|
export default {
|
|
71
75
|
name: "VTable",
|
|
72
76
|
|
|
77
|
+
components: {
|
|
78
|
+
ElTable,
|
|
79
|
+
ElTableColumn,
|
|
80
|
+
VelButton,
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
inject: {
|
|
84
|
+
additionalInfo: {
|
|
85
|
+
default: () => ({}),
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
|
|
73
89
|
props: {
|
|
74
90
|
data: {
|
|
75
91
|
type: [Array, Object],
|
|
@@ -116,7 +132,7 @@ export default {
|
|
|
116
132
|
default: true,
|
|
117
133
|
},
|
|
118
134
|
},
|
|
119
|
-
emits: ["sort"],
|
|
135
|
+
emits: ["sort", "reload"],
|
|
120
136
|
|
|
121
137
|
methods: {
|
|
122
138
|
handleSort(data) {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
</p>
|
|
14
14
|
</div>
|
|
15
15
|
<div class="flex justify-end items-end grid__2/3">
|
|
16
|
-
<
|
|
16
|
+
<VelBasic
|
|
17
17
|
v-if="jsonData.searchable"
|
|
18
18
|
ref="search"
|
|
19
19
|
v-model="search"
|
|
@@ -25,19 +25,23 @@
|
|
|
25
25
|
@update:model-value="handleSearch"
|
|
26
26
|
>
|
|
27
27
|
<template #prepend
|
|
28
|
-
><GIcon
|
|
28
|
+
><GIcon
|
|
29
|
+
embed
|
|
30
|
+
asis
|
|
31
|
+
name="icon-search"
|
|
32
|
+
class="icon--0.5"
|
|
29
33
|
/></template>
|
|
30
|
-
</
|
|
34
|
+
</VelBasic>
|
|
31
35
|
<slot v-if="displayActions" name="table-action">
|
|
32
|
-
<
|
|
33
|
-
v-if="
|
|
36
|
+
<VelButton
|
|
37
|
+
v-if="displayCreateAction"
|
|
34
38
|
size="large"
|
|
35
39
|
type="primary"
|
|
36
40
|
tag="a"
|
|
37
41
|
class="ml-2"
|
|
38
42
|
@click="
|
|
39
43
|
$router.push({
|
|
40
|
-
name: `${jsonData.
|
|
44
|
+
name: `${jsonData.slug}.create`,
|
|
41
45
|
})
|
|
42
46
|
"
|
|
43
47
|
>
|
|
@@ -45,16 +49,16 @@
|
|
|
45
49
|
name="icon-plus"
|
|
46
50
|
embed
|
|
47
51
|
asis
|
|
48
|
-
class="fill-0 mr-0.5"
|
|
52
|
+
class="fill-0 icon--0.5 mr-0.5"
|
|
49
53
|
/>
|
|
50
54
|
Create new {{ jsonData.label }}
|
|
51
|
-
</
|
|
55
|
+
</VelButton>
|
|
52
56
|
</slot>
|
|
53
57
|
</div>
|
|
54
58
|
</slot>
|
|
55
59
|
</div>
|
|
56
60
|
<div class="bg-0 p-0.5 box-shadow-1 border-r-4">
|
|
57
|
-
<
|
|
61
|
+
<VelTable
|
|
58
62
|
:data="table_data"
|
|
59
63
|
:structure="jsonData.tableStructure"
|
|
60
64
|
:label="jsonData.label"
|
|
@@ -62,23 +66,24 @@
|
|
|
62
66
|
:fixed-height="fixedHeight"
|
|
63
67
|
:target-action="
|
|
64
68
|
(item) => ({
|
|
65
|
-
name: `${jsonData.
|
|
66
|
-
params: {
|
|
69
|
+
name: `${jsonData.slug}.show`,
|
|
70
|
+
params: { [idKey]: item.id },
|
|
67
71
|
})
|
|
68
72
|
"
|
|
69
73
|
:edit-action="
|
|
70
74
|
(item) => ({
|
|
71
|
-
name: `${jsonData.
|
|
72
|
-
params: {
|
|
75
|
+
name: `${jsonData.slug}.edit`,
|
|
76
|
+
params: { [idKey]: item.id },
|
|
73
77
|
})
|
|
74
78
|
"
|
|
75
79
|
:display-actions="displayActions"
|
|
76
80
|
:display-show-action="displayShowAction"
|
|
77
81
|
:display-edit-action="displayEditAction"
|
|
78
82
|
@sort="handleSort"
|
|
83
|
+
@reload="reload"
|
|
79
84
|
>
|
|
80
85
|
<slot name="table-content"></slot>
|
|
81
|
-
</
|
|
86
|
+
</VelTable>
|
|
82
87
|
|
|
83
88
|
<div class="flex justify-center items-center py-2">
|
|
84
89
|
<el-pagination
|
|
@@ -93,36 +98,41 @@
|
|
|
93
98
|
</div>
|
|
94
99
|
</div>
|
|
95
100
|
<div v-else class="absolute transform-center text-center">
|
|
96
|
-
<
|
|
97
|
-
<p v-text="`Loading...`" />
|
|
101
|
+
<VelSpinner />
|
|
98
102
|
</div>
|
|
99
103
|
</template>
|
|
100
104
|
|
|
101
105
|
<script>
|
|
106
|
+
import axios from "axios";
|
|
107
|
+
import { ElPagination } from "element-plus";
|
|
108
|
+
import VelButton from "../basic/Button.vue";
|
|
109
|
+
import VelBasic from "../form/basic.vue";
|
|
110
|
+
import VelSpinner from "../form/Spinner.vue";
|
|
111
|
+
|
|
102
112
|
export default {
|
|
103
|
-
name: "
|
|
113
|
+
name: "TableSorter",
|
|
104
114
|
|
|
105
115
|
components: {
|
|
106
|
-
|
|
116
|
+
VelTable: require("./Table.vue").default,
|
|
117
|
+
VelButton,
|
|
118
|
+
VelBasic,
|
|
119
|
+
ElPagination,
|
|
120
|
+
VelSpinner,
|
|
107
121
|
},
|
|
108
122
|
|
|
109
123
|
props: {
|
|
110
124
|
jsonData: {
|
|
111
125
|
required: true,
|
|
112
|
-
type:
|
|
126
|
+
type: Object,
|
|
113
127
|
},
|
|
114
128
|
fixedHeight: {
|
|
115
129
|
default: true,
|
|
116
130
|
type: Boolean,
|
|
117
131
|
},
|
|
118
|
-
|
|
119
|
-
required: true,
|
|
120
|
-
type: String,
|
|
121
|
-
},
|
|
122
|
-
defaults: {
|
|
132
|
+
apiParams: {
|
|
123
133
|
required: false,
|
|
124
|
-
type:
|
|
125
|
-
default:
|
|
134
|
+
type: Object,
|
|
135
|
+
default: () => ({}),
|
|
126
136
|
},
|
|
127
137
|
displayActions: {
|
|
128
138
|
type: Boolean,
|
|
@@ -132,17 +142,25 @@ export default {
|
|
|
132
142
|
type: Boolean,
|
|
133
143
|
default: true,
|
|
134
144
|
},
|
|
145
|
+
displayCreateAction: {
|
|
146
|
+
type: Boolean,
|
|
147
|
+
default: true,
|
|
148
|
+
},
|
|
135
149
|
displayEditAction: {
|
|
136
150
|
type: Boolean,
|
|
137
151
|
default: true,
|
|
138
152
|
},
|
|
153
|
+
idKey: {
|
|
154
|
+
type: String,
|
|
155
|
+
default: "id",
|
|
156
|
+
},
|
|
139
157
|
},
|
|
140
158
|
|
|
141
159
|
data() {
|
|
142
160
|
return {
|
|
143
161
|
search: null,
|
|
144
162
|
sort: "-id",
|
|
145
|
-
query:
|
|
163
|
+
query: {},
|
|
146
164
|
table_data: [],
|
|
147
165
|
table_meta: null,
|
|
148
166
|
};
|
|
@@ -159,13 +177,21 @@ export default {
|
|
|
159
177
|
},
|
|
160
178
|
|
|
161
179
|
methods: {
|
|
180
|
+
reload() {
|
|
181
|
+
this.fetchData({ page: this.table_meta.current_page }).then(
|
|
182
|
+
(data) => {
|
|
183
|
+
this.table_data = data.data;
|
|
184
|
+
this.table_meta = data.meta;
|
|
185
|
+
},
|
|
186
|
+
);
|
|
187
|
+
},
|
|
162
188
|
handleSearch(data) {
|
|
163
189
|
if (data === null || data.length < 3) {
|
|
164
|
-
this.query =
|
|
190
|
+
this.query = {};
|
|
165
191
|
} else {
|
|
166
|
-
this.query =
|
|
167
|
-
`filter[${this.$refs.search.$el.dataset.key}]
|
|
168
|
-
|
|
192
|
+
this.query = {
|
|
193
|
+
[`filter[${this.$refs.search.$el.dataset.key}]`]: data,
|
|
194
|
+
};
|
|
169
195
|
}
|
|
170
196
|
this.fetchData({}).then((data) => {
|
|
171
197
|
this.table_data = data.data;
|
|
@@ -186,18 +212,17 @@ export default {
|
|
|
186
212
|
},
|
|
187
213
|
|
|
188
214
|
fetchData: function ({ page = "1" }) {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
});
|
|
215
|
+
return axios
|
|
216
|
+
.get(`${this.$props.jsonData.api}`, {
|
|
217
|
+
params: {
|
|
218
|
+
sort: this.sort,
|
|
219
|
+
page: page,
|
|
220
|
+
...this.query,
|
|
221
|
+
...this.apiParams,
|
|
222
|
+
},
|
|
223
|
+
})
|
|
224
|
+
.then((res) => res.data)
|
|
225
|
+
.catch(console.log);
|
|
201
226
|
},
|
|
202
227
|
|
|
203
228
|
getStatusLabel(status) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<el-menu-item
|
|
2
|
+
<el-menu-item class="vel-menu-item" v-bind="$props" :index="`${index}`">
|
|
3
3
|
<template #title>
|
|
4
4
|
<slot name="title" />
|
|
5
5
|
</template>
|
|
@@ -15,6 +15,11 @@ export default {
|
|
|
15
15
|
components: {
|
|
16
16
|
ElMenuItem,
|
|
17
17
|
},
|
|
18
|
-
props:
|
|
18
|
+
props: {
|
|
19
|
+
index: {
|
|
20
|
+
type: [String, Number],
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
19
24
|
};
|
|
20
25
|
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<el-sub-menu
|
|
2
|
+
<el-sub-menu v-bind="$props" :index="`${index}`">
|
|
3
3
|
<template #title>
|
|
4
4
|
<slot name="title" />
|
|
5
5
|
</template>
|
|
@@ -15,6 +15,11 @@ export default {
|
|
|
15
15
|
components: {
|
|
16
16
|
ElSubMenu,
|
|
17
17
|
},
|
|
18
|
-
props:
|
|
18
|
+
props: {
|
|
19
|
+
index: {
|
|
20
|
+
type: [String, Number],
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
19
24
|
};
|
|
20
25
|
</script>
|
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
|
+
import debounce from "lodash/debounce";
|
|
3
|
+
|
|
4
|
+
import { ElNotification } from "element-plus";
|
|
5
|
+
|
|
6
|
+
const displayErrorNotification = debounce(async function errors(e) {
|
|
7
|
+
if (e.response && !e.response.data.errors) {
|
|
8
|
+
ElNotification.error({
|
|
9
|
+
title: "Error",
|
|
10
|
+
message:
|
|
11
|
+
e.response.data.message ||
|
|
12
|
+
`${e.response.status}: ${
|
|
13
|
+
e.response.statusText || "Please try again later!"
|
|
14
|
+
}`,
|
|
15
|
+
duration: 10000,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}, 250);
|
|
2
19
|
|
|
3
20
|
function setAxiosDefaults(baseUrl, router) {
|
|
4
21
|
axios.defaults.baseURL = baseUrl;
|
|
@@ -25,6 +42,8 @@ function setAxiosDefaults(baseUrl, router) {
|
|
|
25
42
|
}
|
|
26
43
|
}
|
|
27
44
|
|
|
45
|
+
displayErrorNotification(error);
|
|
46
|
+
|
|
28
47
|
return Promise.reject(error);
|
|
29
48
|
});
|
|
30
49
|
|