This commit is contained in:
@@ -28,6 +28,9 @@ todo: need a role collection control of some kind for things like case 3417.
|
||||
todo: user options form put color picker last it's pushing down the entire last row
|
||||
also, can it be shorter, there's probably a setting for that
|
||||
|
||||
todo: grid enum roles not always working
|
||||
maybe put a role control in there or replicate that code
|
||||
|
||||
todo: need to test a license downgrade of techs once have User creation stuff done
|
||||
|
||||
todo: Administration - translation
|
||||
|
||||
@@ -5,9 +5,7 @@
|
||||
item-value="id"
|
||||
multiple
|
||||
chips
|
||||
hint="select roles"
|
||||
persistent-hint
|
||||
:value="rolevalue()"
|
||||
:value="selectedRoles"
|
||||
@input="handleInput"
|
||||
:readonly="readonly"
|
||||
:disabled="disabled"
|
||||
@@ -21,23 +19,22 @@
|
||||
/* Xeslint-disable */
|
||||
export default {
|
||||
async created() {
|
||||
//get the available roles
|
||||
//first make sure it's cached
|
||||
await window.$gz.enums.fetchEnumList("AuthorizationRoles");
|
||||
this.availableRoles = window.$gz.enums.getSelectionList(
|
||||
"AuthorizationRoles"
|
||||
);
|
||||
//window.$gz.form.addNoSelectionItem(vm.selectLists.objectTypes);
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
internalValue: null,
|
||||
selectedRoles: [],
|
||||
availableRoles: []
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
value(val) {
|
||||
this.internalValue = val;
|
||||
this.setSelectedItems();
|
||||
}
|
||||
},
|
||||
props: {
|
||||
@@ -64,12 +61,28 @@ export default {
|
||||
}
|
||||
return ret;
|
||||
},
|
||||
rolevalue() {
|
||||
//turn ineternalValue numeric bitfield role value into list of selected roles
|
||||
setSelectedItems() {
|
||||
//turn internalValue numeric bitfield role value into array of selected roles
|
||||
let ret = [];
|
||||
if (this.internalValue != null && this.internalValue != 0) {
|
||||
for (let i = 0; i < this.availableRoles.length; i++) {
|
||||
let role = this.availableRoles[i];
|
||||
if (!!(this.internalValue & role.id)) {
|
||||
ret.push(role.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.selectedRoles = [...ret];
|
||||
},
|
||||
handleInput(value) {
|
||||
//turn list of selected roles into single bitfield value
|
||||
//and emit it
|
||||
let newValue = 0;
|
||||
if (value != null && value != [] && value.length > 0) {
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
let role = value[i];
|
||||
newValue = newValue | role;
|
||||
}
|
||||
}
|
||||
this.$emit("input", newValue);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user