@hostlink/nuxt-light 0.0.70 → 0.0.72
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/dist/module.json +1 -1
- package/dist/runtime/components/l-audit-card.vue +21 -0
- package/dist/runtime/components/l-card.vue +4 -0
- package/dist/runtime/pages/Permission/add.vue +1 -1
- package/dist/runtime/pages/Role/_name/update-child.vue +18 -0
- package/dist/runtime/pages/Role/index.vue +32 -7
- package/dist/runtime/pages/User/_user_id/update-role.vue +53 -0
- package/dist/runtime/pages/User/_user_id/view.vue +3 -1
- package/dist/runtime/routes.mjs +20 -0
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
|
|
3
|
+
defineProps({
|
|
4
|
+
modelValue: {
|
|
5
|
+
type: Object,
|
|
6
|
+
required: true
|
|
7
|
+
}
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
</script>
|
|
11
|
+
<template>
|
|
12
|
+
<l-card>
|
|
13
|
+
<l-list>
|
|
14
|
+
<l-item label="Created time">{{ modelValue.createdTime }}</l-item>
|
|
15
|
+
<l-item label="Created by">{{ modelValue.createdBy }}</l-item>
|
|
16
|
+
<l-item label="Updated time">{{ modelValue.updatedTime }}</l-item>
|
|
17
|
+
<l-item label="Updated by">{{ modelValue.updateBy }}</l-item>
|
|
18
|
+
</l-list>
|
|
19
|
+
</l-card>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
@@ -4,6 +4,7 @@ import { useAttrs } from 'vue'
|
|
|
4
4
|
|
|
5
5
|
defineProps({
|
|
6
6
|
loading: Boolean,
|
|
7
|
+
title: String
|
|
7
8
|
})
|
|
8
9
|
|
|
9
10
|
const light = useLight();
|
|
@@ -21,6 +22,9 @@ const attrs = {
|
|
|
21
22
|
</script>
|
|
22
23
|
<template>
|
|
23
24
|
<q-card v-bind="attrs">
|
|
25
|
+
<q-toolbar v-if="title">
|
|
26
|
+
<q-toolbar-title>{{ title }}</q-toolbar-title>
|
|
27
|
+
</q-toolbar>
|
|
24
28
|
<slot></slot>
|
|
25
29
|
|
|
26
30
|
<q-inner-loading :showing="loading" label="Please wait..." label-class="text-primary" />
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useRoute } from 'vue-router';
|
|
3
|
+
import { q } from '../../../'
|
|
4
|
+
const route = useRoute();
|
|
5
|
+
const name = route.params.name;
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const role = await q("getRole", {
|
|
9
|
+
name: name,
|
|
10
|
+
}, ["childs"])
|
|
11
|
+
|
|
12
|
+
</script>
|
|
13
|
+
<template>
|
|
14
|
+
<l-page>
|
|
15
|
+
{{ name }}
|
|
16
|
+
{{ role }}
|
|
17
|
+
</l-page>
|
|
18
|
+
</template>
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { useQuasar } from 'quasar'
|
|
3
3
|
import { q, m } from '../../'
|
|
4
|
-
import { ref } from "vue"
|
|
4
|
+
import { ref, reactive } from "vue"
|
|
5
5
|
|
|
6
6
|
const qua = useQuasar();
|
|
7
7
|
|
|
8
8
|
const loadData = async () => {
|
|
9
|
-
return await q("listRole", ["name", "canDelete",
|
|
10
|
-
|
|
9
|
+
return await q("listRole", ["name", "canDelete", "canUpdate", "children"]);
|
|
11
10
|
}
|
|
12
11
|
const roles = ref(await loadData());
|
|
13
12
|
|
|
13
|
+
let role_options = roles.value.map(r => ({ label: r.name, value: r.name }))
|
|
14
|
+
|
|
14
15
|
const onDelete = async (role) => {
|
|
15
16
|
//confirm
|
|
16
17
|
qua.dialog({
|
|
@@ -38,27 +39,51 @@ const columns = [
|
|
|
38
39
|
align: "left",
|
|
39
40
|
sortable: true,
|
|
40
41
|
}, {
|
|
41
|
-
name: "
|
|
42
|
-
label: "
|
|
42
|
+
name: "children",
|
|
43
|
+
label: "Children",
|
|
43
44
|
align: "left",
|
|
44
45
|
}
|
|
45
46
|
]
|
|
46
47
|
|
|
48
|
+
const onRemoveChild = async (value, child) => {
|
|
49
|
+
await m("removeRoleChild", {
|
|
50
|
+
name: value,
|
|
51
|
+
child: child.value
|
|
52
|
+
|
|
53
|
+
});
|
|
54
|
+
//refresh
|
|
55
|
+
roles.value = await loadData();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const onAddChild = async (value, child) => {
|
|
59
|
+
await m("addRoleChild", {
|
|
60
|
+
name: value,
|
|
61
|
+
child: child.value.value
|
|
62
|
+
|
|
63
|
+
});
|
|
64
|
+
//refresh
|
|
65
|
+
roles.value = await loadData();
|
|
66
|
+
}
|
|
47
67
|
</script>
|
|
48
68
|
|
|
49
69
|
<template>
|
|
50
70
|
<l-page>
|
|
71
|
+
|
|
51
72
|
<q-table :rows="roles" flat bordered :columns="columns">
|
|
52
73
|
<template #body-cell-_can_delete="props">
|
|
53
74
|
<q-td auto-width>
|
|
54
75
|
<q-btn v-if="props.row.canDelete" flat round dense icon="sym_o_delete"
|
|
55
76
|
@click="onDelete(props.row.name)" />
|
|
77
|
+
|
|
56
78
|
</q-td>
|
|
57
79
|
</template>
|
|
58
80
|
|
|
59
|
-
<template #body-cell-
|
|
81
|
+
<template #body-cell-children="props">
|
|
60
82
|
<q-td>
|
|
61
|
-
<q-
|
|
83
|
+
<q-select :options="role_options" v-model="props.row.children" multiple use-chips
|
|
84
|
+
@remove="onRemoveChild(props.row.name, $event)" @add="onAddChild(props.row.name, $event)">
|
|
85
|
+
|
|
86
|
+
</q-select>
|
|
62
87
|
</q-td>
|
|
63
88
|
</template>
|
|
64
89
|
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { reactive } from 'vue'
|
|
3
|
+
import { Notify } from 'quasar';
|
|
4
|
+
import { useRouter } from "vue-router"
|
|
5
|
+
import { getObject, q, m } from '../../../'
|
|
6
|
+
|
|
7
|
+
const router = useRouter();
|
|
8
|
+
const obj = reactive(await getObject(["user_id", "roles"]));
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
//get all roles
|
|
13
|
+
let roles = await q("listRole", ["name"]);
|
|
14
|
+
roles = roles.map((role) => {
|
|
15
|
+
return {
|
|
16
|
+
label: role.name,
|
|
17
|
+
value: role.name,
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const submit = async () => {
|
|
22
|
+
|
|
23
|
+
if (await m("updateUserRole", {
|
|
24
|
+
user_id: obj.user_id,
|
|
25
|
+
roles: obj.roles
|
|
26
|
+
})) {
|
|
27
|
+
//show success message
|
|
28
|
+
|
|
29
|
+
Notify.create({
|
|
30
|
+
message: 'Role updated',
|
|
31
|
+
color: 'positive',
|
|
32
|
+
icon: 'check',
|
|
33
|
+
position: 'top-right'
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
//go back to list page
|
|
37
|
+
router.back();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
</script>
|
|
42
|
+
<template>
|
|
43
|
+
<l-page>
|
|
44
|
+
<l-form @submit="submit">
|
|
45
|
+
<q-field label="Roles" stack-label>
|
|
46
|
+
<q-option-group type="checkbox" :options="roles" v-model="obj.roles" inline>
|
|
47
|
+
</q-option-group>
|
|
48
|
+
</q-field>
|
|
49
|
+
|
|
50
|
+
</l-form>
|
|
51
|
+
|
|
52
|
+
</l-page>
|
|
53
|
+
</template>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { getObject, loadObject } from '../../../';
|
|
3
|
-
const obj = await getObject(["user_id", "username", "first_name", "last_name", "email", "phone", "roles"]);
|
|
3
|
+
const obj = await getObject(["user_id", "username", "first_name", "last_name", "email", "phone", "roles",'status']);
|
|
4
4
|
|
|
5
5
|
//await getObject(["user_id", { test: ["username"] }])
|
|
6
6
|
/* const test = async () => {
|
|
@@ -14,7 +14,9 @@ const obj = await getObject(["user_id", "username", "first_name", "last_name", "
|
|
|
14
14
|
<l-page>
|
|
15
15
|
<template #header>
|
|
16
16
|
<l-btn to="change-password" icon="sym_o_key" permission="user.changePassword" label="Change password"></l-btn>
|
|
17
|
+
<l-btn to="update-role" icon="sym_o_people" permission="user.role.add" label="Update role"></l-btn>
|
|
17
18
|
</template>
|
|
19
|
+
{{ obj }}
|
|
18
20
|
<l-card>
|
|
19
21
|
<l-list>
|
|
20
22
|
<l-item label="Username">{{ obj.username }}</l-item>
|
package/dist/runtime/routes.mjs
CHANGED
|
@@ -156,6 +156,11 @@ function EventLog__eventlog_id_view() {
|
|
|
156
156
|
/* webpackChunkName: "EventLog-eventlog_id-view" */ './pages/EventLog/_eventlog_id/view.vue'
|
|
157
157
|
)
|
|
158
158
|
}
|
|
159
|
+
function Role__name_update_child() {
|
|
160
|
+
return import(
|
|
161
|
+
/* webpackChunkName: "Role-name-update-child" */ './pages/Role/_name/update-child.vue'
|
|
162
|
+
)
|
|
163
|
+
}
|
|
159
164
|
function User__user_id_change_password() {
|
|
160
165
|
return import(
|
|
161
166
|
/* webpackChunkName: "User-user_id-change-password" */ './pages/User/_user_id/change-password.vue'
|
|
@@ -166,6 +171,11 @@ function User__user_id_edit() {
|
|
|
166
171
|
/* webpackChunkName: "User-user_id-edit" */ './pages/User/_user_id/edit.vue'
|
|
167
172
|
)
|
|
168
173
|
}
|
|
174
|
+
function User__user_id_update_role() {
|
|
175
|
+
return import(
|
|
176
|
+
/* webpackChunkName: "User-user_id-update-role" */ './pages/User/_user_id/update-role.vue'
|
|
177
|
+
)
|
|
178
|
+
}
|
|
169
179
|
function User__user_id_view() {
|
|
170
180
|
return import(
|
|
171
181
|
/* webpackChunkName: "User-user_id-view" */ './pages/User/_user_id/view.vue'
|
|
@@ -344,6 +354,11 @@ export default [
|
|
|
344
354
|
path: '/EventLog/:eventlog_id/view',
|
|
345
355
|
component: EventLog__eventlog_id_view,
|
|
346
356
|
},
|
|
357
|
+
{
|
|
358
|
+
name: 'Role-name-update-child',
|
|
359
|
+
path: '/Role/:name/update-child',
|
|
360
|
+
component: Role__name_update_child,
|
|
361
|
+
},
|
|
347
362
|
{
|
|
348
363
|
name: 'User-user_id-change-password',
|
|
349
364
|
path: '/User/:user_id/change-password',
|
|
@@ -354,6 +369,11 @@ export default [
|
|
|
354
369
|
path: '/User/:user_id/edit',
|
|
355
370
|
component: User__user_id_edit,
|
|
356
371
|
},
|
|
372
|
+
{
|
|
373
|
+
name: 'User-user_id-update-role',
|
|
374
|
+
path: '/User/:user_id/update-role',
|
|
375
|
+
component: User__user_id_update_role,
|
|
376
|
+
},
|
|
357
377
|
{
|
|
358
378
|
name: 'User-user_id-view',
|
|
359
379
|
path: '/User/:user_id/view',
|