@hostlink/nuxt-light 0.0.102 → 0.0.103
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
CHANGED
|
@@ -6,12 +6,17 @@ import { ref, reactive } from "vue"
|
|
|
6
6
|
const qua = useQuasar();
|
|
7
7
|
|
|
8
8
|
const loadData = async () => {
|
|
9
|
-
return await q("listRole", ["name", "canDelete", "canUpdate", "children"
|
|
9
|
+
return await q("listRole", ["name", "canDelete", "canUpdate", "children", {
|
|
10
|
+
user: ["name", "user_id"]
|
|
11
|
+
}]);
|
|
10
12
|
}
|
|
11
13
|
const roles = ref(await loadData());
|
|
12
|
-
|
|
13
14
|
let role_options = roles.value.map(r => ({ label: r.name, value: r.name }))
|
|
14
15
|
|
|
16
|
+
const users = (await q("listUser", [{
|
|
17
|
+
data: ["user_id", "name"]
|
|
18
|
+
}])).data;
|
|
19
|
+
|
|
15
20
|
const onDelete = async (role) => {
|
|
16
21
|
//confirm
|
|
17
22
|
qua.dialog({
|
|
@@ -42,6 +47,10 @@ const columns = [
|
|
|
42
47
|
name: "children",
|
|
43
48
|
label: "Children",
|
|
44
49
|
align: "left",
|
|
50
|
+
}, {
|
|
51
|
+
label: 'User',
|
|
52
|
+
align: 'left',
|
|
53
|
+
name: "user",
|
|
45
54
|
}
|
|
46
55
|
]
|
|
47
56
|
|
|
@@ -64,12 +73,31 @@ const onAddChild = async (value, child) => {
|
|
|
64
73
|
//refresh
|
|
65
74
|
roles.value = await loadData();
|
|
66
75
|
}
|
|
76
|
+
|
|
77
|
+
const onAddUser = async (value, user) => {
|
|
78
|
+
await m("addUserRole", {
|
|
79
|
+
role: value,
|
|
80
|
+
user_id: user.value.user_id
|
|
81
|
+
|
|
82
|
+
});
|
|
83
|
+
//refresh
|
|
84
|
+
roles.value = await loadData();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const onRemoveUser = async (value, user) => {
|
|
88
|
+
await m("removeUserRole", {
|
|
89
|
+
role: value,
|
|
90
|
+
user_id: user.value.user_id
|
|
91
|
+
|
|
92
|
+
});
|
|
93
|
+
//refresh
|
|
94
|
+
roles.value = await loadData();
|
|
95
|
+
}
|
|
67
96
|
</script>
|
|
68
97
|
|
|
69
98
|
<template>
|
|
70
99
|
<l-page>
|
|
71
|
-
|
|
72
|
-
<q-table :rows="roles" flat bordered :columns="columns">
|
|
100
|
+
<q-table :rows="roles" flat bordered :columns="columns" :rows-per-page-options="[0]">
|
|
73
101
|
<template #body-cell-_can_delete="props">
|
|
74
102
|
<q-td auto-width>
|
|
75
103
|
<q-btn v-if="props.row.canDelete" flat round dense icon="sym_o_delete"
|
|
@@ -86,8 +114,15 @@ const onAddChild = async (value, child) => {
|
|
|
86
114
|
</q-select>
|
|
87
115
|
</q-td>
|
|
88
116
|
</template>
|
|
117
|
+
<template #body-cell-user="props">
|
|
118
|
+
<q-td>
|
|
119
|
+
<q-select :options="users" v-model="props.row.user" multiple use-chips option-label="name"
|
|
120
|
+
option-value="user_id" @add="onAddUser(props.row.name, $event)"
|
|
121
|
+
@remove="onRemoveUser(props.row.name, $event)">
|
|
89
122
|
|
|
123
|
+
</q-select>
|
|
124
|
+
</q-td>
|
|
125
|
+
</template>
|
|
90
126
|
</q-table>
|
|
91
|
-
|
|
92
127
|
</l-page>
|
|
93
128
|
</template>
|