#7864 - 7864_testToMaster_2434 #629
|
@ -124,7 +124,7 @@ const tableModes = [
|
||||||
];
|
];
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
setUserParams(route.query[$props.searchUrl]);
|
setUserParams(route.query[$props.searchUrl]);
|
||||||
hasParams.value = Object.keys(params.value).length !== 0;
|
hasParams.value = params.value && Object.keys(params.value).length !== 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
@ -158,7 +158,10 @@ function setUserParams(watchedParams) {
|
||||||
if (!watchedParams) return;
|
if (!watchedParams) return;
|
||||||
|
|
||||||
if (typeof watchedParams == 'string') watchedParams = JSON.parse(watchedParams);
|
if (typeof watchedParams == 'string') watchedParams = JSON.parse(watchedParams);
|
||||||
const filter = JSON.parse(watchedParams?.filter);
|
const filter =
|
||||||
|
typeof watchedParams?.filter == 'string'
|
||||||
|
? JSON.parse(watchedParams?.filter)
|
||||||
|
: watchedParams?.filter;
|
||||||
const where = filter?.where;
|
const where = filter?.where;
|
||||||
const order = filter?.order;
|
const order = filter?.order;
|
||||||
|
|
||||||
|
@ -281,6 +284,7 @@ defineExpose({
|
||||||
v-model="params"
|
v-model="params"
|
||||||
:search-url="searchUrl"
|
:search-url="searchUrl"
|
||||||
:redirect="!!redirect"
|
:redirect="!!redirect"
|
||||||
|
@set-user-params="setUserParams"
|
||||||
>
|
>
|
||||||
<template #body>
|
<template #body>
|
||||||
<div
|
<div
|
||||||
|
|
|
@ -30,10 +30,10 @@ function mix(toComponent) {
|
||||||
mixed = {
|
mixed = {
|
||||||
component: customComponent?.component ?? component,
|
component: customComponent?.component ?? component,
|
||||||
attrs: {
|
attrs: {
|
||||||
...toValueAttrs(customComponent?.attrs),
|
|
||||||
...toValueAttrs(customComponent?.forceAttrs),
|
|
||||||
...toComponent,
|
|
||||||
...toValueAttrs(attrs),
|
...toValueAttrs(attrs),
|
||||||
|
...toValueAttrs(customComponent?.attrs),
|
||||||
|
...toComponent,
|
||||||
|
...toValueAttrs(customComponent?.forceAttrs),
|
||||||
},
|
},
|
||||||
event: { ...customComponent?.event, ...event },
|
event: { ...customComponent?.event, ...event },
|
||||||
};
|
};
|
||||||
|
|
|
@ -57,7 +57,7 @@ const $props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
defineExpose({ search });
|
defineExpose({ search, sanitizer });
|
||||||
const emit = defineEmits([
|
const emit = defineEmits([
|
||||||
'update:modelValue',
|
'update:modelValue',
|
||||||
'refresh',
|
'refresh',
|
||||||
|
@ -65,6 +65,7 @@ const emit = defineEmits([
|
||||||
'search',
|
'search',
|
||||||
'init',
|
'init',
|
||||||
'remove',
|
'remove',
|
||||||
|
'setUserParams',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const arrayData = useArrayData($props.dataKey, {
|
const arrayData = useArrayData($props.dataKey, {
|
||||||
|
@ -87,6 +88,7 @@ function setUserParams(watchedParams) {
|
||||||
watchedParams = { ...watchedParams, ...watchedParams.filter?.where };
|
watchedParams = { ...watchedParams, ...watchedParams.filter?.where };
|
||||||
delete watchedParams.filter;
|
delete watchedParams.filter;
|
||||||
userParams.value = { ...userParams.value, ...watchedParams };
|
userParams.value = { ...userParams.value, ...watchedParams };
|
||||||
|
emit('setUserParams', userParams.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
@ -190,6 +192,14 @@ function formatValue(value) {
|
||||||
|
|
||||||
return `"${value}"`;
|
return `"${value}"`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sanitizer(params) {
|
||||||
|
for (const [key, value] of Object.entries(params)) {
|
||||||
|
if (typeof value == 'object')
|
||||||
|
params[key] = Object.values(value)[0].replaceAll('%', '');
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -272,7 +282,7 @@ function formatValue(value) {
|
||||||
<QSeparator />
|
<QSeparator />
|
||||||
</QList>
|
</QList>
|
||||||
<QList dense class="list q-gutter-y-sm q-mt-sm">
|
<QList dense class="list q-gutter-y-sm q-mt-sm">
|
||||||
<slot name="body" :params="userParams" :search-fn="search"></slot>
|
<slot name="body" :params="sanitizer(userParams)" :search-fn="search"></slot>
|
||||||
</QList>
|
</QList>
|
||||||
</QForm>
|
</QForm>
|
||||||
<QInnerLoading
|
<QInnerLoading
|
||||||
|
|
|
@ -21,14 +21,16 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'nickname',
|
name: 'username',
|
||||||
label: t('nickname'),
|
label: t('nickname'),
|
||||||
field: 'nickname',
|
|
||||||
isTitle: true,
|
isTitle: true,
|
||||||
component: 'input',
|
component: 'input',
|
||||||
columnField: {
|
columnField: {
|
||||||
component: null,
|
component: null,
|
||||||
},
|
},
|
||||||
|
columnFilter: {
|
||||||
|
inWhere: true,
|
||||||
|
},
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
create: true,
|
create: true,
|
||||||
},
|
},
|
||||||
|
@ -36,11 +38,13 @@ const columns = computed(() => [
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'name',
|
name: 'name',
|
||||||
label: t('name'),
|
label: t('name'),
|
||||||
field: 'name',
|
|
||||||
component: 'input',
|
component: 'input',
|
||||||
columnField: {
|
columnField: {
|
||||||
component: null,
|
component: null,
|
||||||
},
|
},
|
||||||
|
columnFilter: {
|
||||||
|
inWhere: true,
|
||||||
|
},
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
create: true,
|
create: true,
|
||||||
},
|
},
|
||||||
|
@ -88,7 +92,7 @@ const exprBuilder = (param, value) => {
|
||||||
<VnTable
|
<VnTable
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
data-key="AccountUsers"
|
data-key="AccountUsers"
|
||||||
url="VnUsers"
|
url="VnUsers/preview"
|
||||||
order="id DESC"
|
order="id DESC"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
default-mode="table"
|
default-mode="table"
|
||||||
|
|
|
@ -71,90 +71,17 @@ async function sync() {
|
||||||
type: 'positive',
|
type: 'positive',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// const removeAccount = async () => {
|
|
||||||
// try {
|
|
||||||
// quasar
|
|
||||||
// .dialog({
|
|
||||||
// component: VnConfirm,
|
|
||||||
// componentProps: {
|
|
||||||
// title: t('account.card.actions.delete.title'),
|
|
||||||
// message: t('account.card.actions.delete.subTitle'),
|
|
||||||
// promise: async () => {
|
|
||||||
// try {
|
|
||||||
// await axios.delete(`VnUsers/${this.id}`);
|
|
||||||
// notify('Account removed', 'positive');
|
|
||||||
// } catch (error) {
|
|
||||||
// notify('Error removing account', 'negative');
|
|
||||||
// console.error('Error deleting the account', error);
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// })
|
|
||||||
// .onOk(() => {
|
|
||||||
// notify('Account removed', 'positive');
|
|
||||||
// });
|
|
||||||
// } catch (error) {
|
|
||||||
// console.error('Error deleting the account', error);
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
const removeAccount = async () => {
|
const removeAccount = async () => {
|
||||||
try {
|
try {
|
||||||
console.log('id', account.value.id);
|
|
||||||
await axios.delete(`VnUsers/${account.value.id}`);
|
await axios.delete(`VnUsers/${account.value.id}`);
|
||||||
notify(t('Account removed'), 'positive');
|
notify(t('Account removed'), 'positive');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error killing session', error);
|
console.error('Error deleting user', error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<!-- <VnConfirm
|
|
||||||
v-model="showSyncDialog"
|
|
||||||
:message="t('account.card.actions.sync.message')"
|
|
||||||
:title="t('account.card.actions.sync.title')"
|
|
||||||
:promise="sync"
|
|
||||||
>
|
|
||||||
<template #customHTML>
|
|
||||||
{{ shouldSyncPassword }}
|
|
||||||
<QCheckbox
|
|
||||||
:label="t('account.card.actions.sync.checkbox')"
|
|
||||||
v-model="shouldSyncPassword"
|
|
||||||
class="full-width"
|
|
||||||
clearable
|
|
||||||
clear-icon="close"
|
|
||||||
>
|
|
||||||
<QIcon style="padding-left: 10px" color="primary" name="info" size="sm">
|
|
||||||
<QTooltip>{{ t('account.card.actions.sync.tooltip') }}</QTooltip>
|
|
||||||
</QIcon></QCheckbox
|
|
||||||
>
|
|
||||||
<QInput
|
|
||||||
v-if="shouldSyncPassword"
|
|
||||||
:label="t('login.password')"
|
|
||||||
v-model="syncPassword"
|
|
||||||
class="full-width"
|
|
||||||
clearable
|
|
||||||
clear-icon="close"
|
|
||||||
type="password"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</VnConfirm> -->
|
|
||||||
<!-- <QItem v-ripple clickable @click="setPassword">
|
|
||||||
<QItemSection>{{ t('account.card.actions.setPassword') }}</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
<QItem
|
|
||||||
v-if="!account.hasAccount"
|
|
||||||
v-ripple
|
|
||||||
clickable
|
|
||||||
@click="
|
|
||||||
openConfirmationModal(
|
|
||||||
t('account.card.actions.enableAccount.title'),
|
|
||||||
t('account.card.actions.enableAccount.subtitle'),
|
|
||||||
() => updateStatusAccount(true)
|
|
||||||
)
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<QItemSection>{{ t('account.card.actions.enableAccount.name') }}</QItemSection>
|
|
||||||
</QItem> -->
|
|
||||||
<QItem
|
<QItem
|
||||||
v-if="account.hasAccount"
|
v-if="account.hasAccount"
|
||||||
v-ripple
|
v-ripple
|
||||||
|
|
|
@ -23,14 +23,15 @@ const columns = computed(() => [
|
||||||
name: 'id',
|
name: 'id',
|
||||||
label: t('id'),
|
label: t('id'),
|
||||||
isId: true,
|
isId: true,
|
||||||
field: 'id',
|
columnFilter: {
|
||||||
|
inWhere: true,
|
||||||
|
},
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'name',
|
name: 'name',
|
||||||
label: t('name'),
|
label: t('name'),
|
||||||
field: 'name',
|
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
create: true,
|
create: true,
|
||||||
},
|
},
|
||||||
|
@ -38,7 +39,6 @@ const columns = computed(() => [
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'description',
|
name: 'description',
|
||||||
label: t('description'),
|
label: t('description'),
|
||||||
field: 'description',
|
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
create: true,
|
create: true,
|
||||||
},
|
},
|
||||||
|
@ -66,7 +66,6 @@ const exprBuilder = (param, value) => {
|
||||||
<Teleport to="#searchbar">
|
<Teleport to="#searchbar">
|
||||||
<VnSearchbar
|
<VnSearchbar
|
||||||
data-key="Roles"
|
data-key="Roles"
|
||||||
url="VnRoles"
|
|
||||||
:expr-builder="exprBuilder"
|
:expr-builder="exprBuilder"
|
||||||
:label="t('role.searchRoles')"
|
:label="t('role.searchRoles')"
|
||||||
:info="t('role.searchInfo')"
|
:info="t('role.searchInfo')"
|
||||||
|
|
|
@ -35,29 +35,13 @@ const setData = (entity) => (data.value = useCardDescription(entity.name, entity
|
||||||
const filter = {
|
const filter = {
|
||||||
where: { id: entityId },
|
where: { id: entityId },
|
||||||
};
|
};
|
||||||
const removeRole = () => {
|
const removeRole = async () => {
|
||||||
quasar
|
try {
|
||||||
.dialog({
|
await axios.delete(`VnRoles/${entityId.value}`);
|
||||||
title: 'Are you sure you want to delete it?',
|
notify(t('Role removed'), 'positive');
|
||||||
message: 'Delete department',
|
} catch (error) {
|
||||||
ok: {
|
console.error('Error deleting role', error);
|
||||||
push: true,
|
}
|
||||||
color: 'primary',
|
|
||||||
},
|
|
||||||
cancel: true,
|
|
||||||
})
|
|
||||||
.onOk(async () => {
|
|
||||||
try {
|
|
||||||
await axios.post(
|
|
||||||
`/Departments/${entityId.value}/removeChild`,
|
|
||||||
entityId.value
|
|
||||||
);
|
|
||||||
router.push({ name: 'WorkerDepartment' });
|
|
||||||
notify('department.departmentRemoved', 'positive');
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Error removing department');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue