refactor: request list role check
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 6s
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 6s
This commit is contained in:
parent
963ed11073
commit
48a1800b54
4 changed files with 19 additions and 5 deletions
|
|
@ -21,7 +21,7 @@ import { column } from './constants';
|
||||||
import useFlowStore from 'src/stores/flow';
|
import useFlowStore from 'src/stores/flow';
|
||||||
import { useRequestList } from 'src/stores/request-list';
|
import { useRequestList } from 'src/stores/request-list';
|
||||||
import { RequestData, RequestDataStatus } from 'src/stores/request-list/types';
|
import { RequestData, RequestDataStatus } from 'src/stores/request-list/types';
|
||||||
import { dialogWarningClose } from 'src/stores/utils';
|
import { dialogWarningClose, canAccess } from 'src/stores/utils';
|
||||||
import { CancelButton, SaveButton } from 'src/components/button';
|
import { CancelButton, SaveButton } from 'src/components/button';
|
||||||
import { getRole } from 'src/services/keycloak';
|
import { getRole } from 'src/services/keycloak';
|
||||||
import FloatingActionButton from 'src/components/FloatingActionButton.vue';
|
import FloatingActionButton from 'src/components/FloatingActionButton.vue';
|
||||||
|
|
@ -473,6 +473,7 @@ watch(
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<TableRequestList
|
<TableRequestList
|
||||||
|
:no-link="!canAccess('related', 'edit')"
|
||||||
:columns="column"
|
:columns="column"
|
||||||
:rows="data"
|
:rows="data"
|
||||||
:grid="pageState.gridView"
|
:grid="pageState.gridView"
|
||||||
|
|
@ -574,6 +575,7 @@ watch(
|
||||||
v-if="requestListActionData"
|
v-if="requestListActionData"
|
||||||
v-model="pageState.requestListActionDialog"
|
v-model="pageState.requestListActionDialog"
|
||||||
:request-list="requestListActionData"
|
:request-list="requestListActionData"
|
||||||
|
:no-link="!canAccess('related', 'edit')"
|
||||||
@submit="submitRequestListAction"
|
@submit="submitRequestListAction"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ import useAddressStore from 'src/stores/address';
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
requestList: RequestData[];
|
requestList: RequestData[];
|
||||||
|
noLink?: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
defineEmits<{
|
defineEmits<{
|
||||||
|
|
@ -99,6 +100,7 @@ watch(
|
||||||
hide-action
|
hide-action
|
||||||
hide-view
|
hide-view
|
||||||
checkable
|
checkable
|
||||||
|
:no-link="noLink"
|
||||||
:list-same-area="listSameArea"
|
:list-same-area="listSameArea"
|
||||||
:columns="column"
|
:columns="column"
|
||||||
:rows="requestList"
|
:rows="requestList"
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import {
|
||||||
getEmployeeName,
|
getEmployeeName,
|
||||||
getCustomerName,
|
getCustomerName,
|
||||||
dialogWarningClose,
|
dialogWarningClose,
|
||||||
|
canAccess,
|
||||||
} from 'src/stores/utils';
|
} from 'src/stores/utils';
|
||||||
import { dateFormatJS } from 'src/utils/datetime';
|
import { dateFormatJS } from 'src/utils/datetime';
|
||||||
import { useRequestList } from 'src/stores/request-list';
|
import { useRequestList } from 'src/stores/request-list';
|
||||||
|
|
@ -459,6 +460,7 @@ async function submitRejectCancel() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function toCustomer(customer: RequestData['quotation']['customerBranch']) {
|
function toCustomer(customer: RequestData['quotation']['customerBranch']) {
|
||||||
|
if (!canAccess('related', 'edit')) return;
|
||||||
const url = new URL(
|
const url = new URL(
|
||||||
`/customer-management?tab=customer&id=${customer.customerId}`,
|
`/customer-management?tab=customer&id=${customer.customerId}`,
|
||||||
window.location.origin,
|
window.location.origin,
|
||||||
|
|
@ -468,6 +470,7 @@ function toCustomer(customer: RequestData['quotation']['customerBranch']) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function toEmployee(employee: RequestData['employee']) {
|
function toEmployee(employee: RequestData['employee']) {
|
||||||
|
if (!canAccess('related', 'edit')) return;
|
||||||
const url = new URL(
|
const url = new URL(
|
||||||
`/customer-management?tab=employee&id=${employee.id}`,
|
`/customer-management?tab=employee&id=${employee.id}`,
|
||||||
window.location.origin,
|
window.location.origin,
|
||||||
|
|
@ -742,7 +745,7 @@ function toEmployee(employee: RequestData['employee']) {
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<DataDisplay
|
<DataDisplay
|
||||||
clickable
|
:clickable="canAccess('related', 'edit')"
|
||||||
class="col"
|
class="col"
|
||||||
icon="mdi-account-settings-outline"
|
icon="mdi-account-settings-outline"
|
||||||
:label="$t('customer.employer')"
|
:label="$t('customer.employer')"
|
||||||
|
|
@ -755,7 +758,7 @@ function toEmployee(employee: RequestData['employee']) {
|
||||||
@label-click="toCustomer(data.quotation.customerBranch)"
|
@label-click="toCustomer(data.quotation.customerBranch)"
|
||||||
/>
|
/>
|
||||||
<DataDisplay
|
<DataDisplay
|
||||||
clickable
|
:clickable="canAccess('related', 'edit')"
|
||||||
class="col"
|
class="col"
|
||||||
icon="mdi-account-settings-outline"
|
icon="mdi-account-settings-outline"
|
||||||
:label="$t('customer.employee')"
|
:label="$t('customer.employee')"
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ const props = withDefaults(
|
||||||
hideView?: boolean;
|
hideView?: boolean;
|
||||||
checkable?: boolean;
|
checkable?: boolean;
|
||||||
listSameArea?: string[];
|
listSameArea?: string[];
|
||||||
|
noLink?: boolean;
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
row: () => [],
|
row: () => [],
|
||||||
|
|
@ -119,6 +120,7 @@ function getEmployeeName(
|
||||||
}
|
}
|
||||||
|
|
||||||
function toCustomer(customer: RequestData['quotation']['customerBranch']) {
|
function toCustomer(customer: RequestData['quotation']['customerBranch']) {
|
||||||
|
if (props.noLink) return;
|
||||||
const url = new URL(
|
const url = new URL(
|
||||||
`/customer-management?tab=customer&id=${customer.customerId}`,
|
`/customer-management?tab=customer&id=${customer.customerId}`,
|
||||||
window.location.origin,
|
window.location.origin,
|
||||||
|
|
@ -128,6 +130,7 @@ function toCustomer(customer: RequestData['quotation']['customerBranch']) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function toEmployee(employee: RequestData['employee']) {
|
function toEmployee(employee: RequestData['employee']) {
|
||||||
|
if (props.noLink) return;
|
||||||
const url = new URL(
|
const url = new URL(
|
||||||
`/customer-management?tab=employee&id=${employee.id}`,
|
`/customer-management?tab=employee&id=${employee.id}`,
|
||||||
window.location.origin,
|
window.location.origin,
|
||||||
|
|
@ -234,7 +237,7 @@ function handleCheckAll() {
|
||||||
</q-td>
|
</q-td>
|
||||||
<q-td v-if="visibleColumns.includes('employer')" class="text-left">
|
<q-td v-if="visibleColumns.includes('employer')" class="text-left">
|
||||||
<span
|
<span
|
||||||
class="link"
|
:class="{ link: !noLink }"
|
||||||
@click="toCustomer(props.row.quotation.customerBranch)"
|
@click="toCustomer(props.row.quotation.customerBranch)"
|
||||||
>
|
>
|
||||||
{{
|
{{
|
||||||
|
|
@ -246,7 +249,10 @@ function handleCheckAll() {
|
||||||
</span>
|
</span>
|
||||||
</q-td>
|
</q-td>
|
||||||
<q-td v-if="visibleColumns.includes('employee')" class="text-left">
|
<q-td v-if="visibleColumns.includes('employee')" class="text-left">
|
||||||
<span class="link" @click="toEmployee(props.row.employee)">
|
<span
|
||||||
|
:class="{ link: !noLink }"
|
||||||
|
@click="toEmployee(props.row.employee)"
|
||||||
|
>
|
||||||
{{ getEmployeeName(props.row, { locale: $i18n.locale }) || '-' }}
|
{{ getEmployeeName(props.row, { locale: $i18n.locale }) || '-' }}
|
||||||
</span>
|
</span>
|
||||||
</q-td>
|
</q-td>
|
||||||
|
|
@ -403,6 +409,7 @@ function handleCheckAll() {
|
||||||
hide-kebab-delete
|
hide-kebab-delete
|
||||||
:use-cancel="!hideAction"
|
:use-cancel="!hideAction"
|
||||||
class="full-height"
|
class="full-height"
|
||||||
|
:hide-action="hideAction"
|
||||||
:use-reject-cancel="
|
:use-reject-cancel="
|
||||||
props.row.customerRequestCancel && !props.row.rejectRequestCancel
|
props.row.customerRequestCancel && !props.row.rejectRequestCancel
|
||||||
"
|
"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue