update

parent 21d181b6
......@@ -39,7 +39,7 @@ export enum API_PATHS {
resetPassword = '/user/resetPass',
getUserDetail = '/user/detail',
updateUser = '/user/update',
getListUnits = '/artistOwner',
getListUnits = '/artistOwner/listManangement',
getListArtists = '/artist',
getFieldOptions = '/field',
getClassificationOptions= '/common/classification',
......@@ -50,16 +50,16 @@ export enum API_PATHS {
getQualificationOptions = '/qualification',
getWorkOptions = '/work',
getDetailArtist = '/artist/detail',
deleteManagingUnits = '/artistOwner/delete',
deleteManagingUnits = '/artistOwner/deleteManagement',
deleteArtist = '/artist/delete',
getArtistDicitionaryOptions = 'artist/dictionary',
artistOwnerAdd = 'artistOwner/add',
artistOwnerAdd = 'artistOwner/addManagement',
updateArtist = 'artist/update',
bankOptions = 'bank',
cardTypeOptions = 'cardType',
uploadImage = 'file/upload',
getDetailUnit = 'artistOwner/detail',
updateUnit = 'artistOwner/update',
getDetailUnit = 'artistOwner/detailManangement',
updateUnit = 'artistOwner/updateManagement',
addArtist = 'artist/add',
listCustomers = 'customer',
listCustomerLevel = 'customerLevel',
......@@ -136,5 +136,8 @@ export enum API_PATHS {
configHomeProduct = 'config/home/product',
artistFeaturedProduct= 'artist/featuredProduct',
homeProductNotActive = 'config/home/productNotActive',
artistFeaturedProducts = 'artist/featuredProducts'
artistFeaturedProducts = 'artist/featuredProducts',
// duyệt chủ quản
artistOwnerBrowseManagement = 'artistOwner/browseManagement'
}
......@@ -5,13 +5,7 @@
@update:model-value="$emit('update:isOpened', $event)"
>
<q-card class="full-width" style="max-width: 85.71rem" bordered>
<q-form
greedy
@submit.prevent="
$emit('addNewUnit', {});
"
>
<q-form greedy @submit.prevent="$emit('addNewUnit', {})">
<q-card-section class="q-pa-none">
<q-item>
<q-item-section>
......@@ -138,10 +132,8 @@
option-label="name"
class="q-my-sm"
outlined
clearable
></q-select
>
></q-select>
<div class="q-pt-sm q-pl-sm">
<span class="text-body1">{{
$t('managingUnit.dialogLabel.fieldLabels.status')
......@@ -833,6 +825,7 @@ export default defineComponent({
artistName: artistName.value?.artistName,
artistFullName: artistName.value?.fullName,
field: artistField.value?.name,
fieldId: artistField.value?.id,
};
context.emit('update:artistList', [...newArtistList]);
Notify.create({
......@@ -847,6 +840,7 @@ export default defineComponent({
const addNewArtist = () => {
const newArtistList = [...props.artistList];
newArtistList.push({
contractFrom: `${contractTimeFrom.value} 00:00:00`,
contractTo: `${contractTimeTo.value} 00:00:00`,
......@@ -856,9 +850,10 @@ export default defineComponent({
artistName: artistName.value?.artistName,
artistFullName: artistName.value?.fullName,
field: artistField.value?.name,
fieldId: artistField.value?.id,
});
context.emit('update:artistList', [...newArtistList]);
console.log(newArtistList, 'newArtistList');
Notify.create({
type: 'positive',
message: i18n.global.t(
......
......@@ -31,7 +31,6 @@
>
<div class="row q-col-gutter-sm">
<div class="col-6">
<q-select
:model-value="artistField"
@update:model-value="$emit('update:artistField', $event)"
......@@ -96,14 +95,18 @@
:label="
$t('managingUnitAdd.dialogLabel.fieldLabels.artistName')
"
:options="artistOptions"
:options="filteredOptions"
:rules="artistNameRules"
map-options
option-value="id"
option-label="fullName"
class="q-my-sm"
outlined
><template v-slot:no-option>
use-input
behavior="menu"
@filter="filterFn"
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
{{ $t('managingUnitAdd.noDataTable') }}
......@@ -183,9 +186,12 @@
</template>
<script lang="ts">
import { defineComponent, PropType } from 'vue';
import { defineComponent, PropType, Ref, ref, watch } from 'vue';
import { api, BaseResponseBody } from 'src/boot/axios';
import { AxiosResponse } from 'axios';
import { config, API_PATHS } from 'src/assets/configurations.example';
import { i18n } from 'src/boot/i18n';
import { ArtistInfoType } from 'src/assets/type';
import { ArtistInfoType, ListArrayArtist, FieldType } from 'src/assets/type';
export default defineComponent({
props: {
......@@ -194,15 +200,66 @@ export default defineComponent({
required: true,
},
isUpdate: { type: Boolean, default: false },
artistOptions: { type: Array, required: true },
artistOptions: { type: Array as PropType<FieldType[]>, required: true },
fieldsAddOptions: { type: Array, required: true },
artistField: { type: Number, required: true },
artistField: { type: Object as PropType<ArtistInfoType>, required: true },
artistName: { type: Object as PropType<ArtistInfoType>, required: true },
artistStatus: { type: Number, required: true },
contractTimeFrom: { type: String, required: true },
contractTimeTo: { type: String, required: true },
// rowDataAccBank: {
// type: Object as PropType<BankAccountType>,
// required: true,
// },
},
setup(props, context) {
const isId: Ref<number | null> = ref(null);
const artistListOptions: Ref<ArtistInfoType[]> = ref([]);
const filteredOptions: Ref<ArtistInfoType[]> = ref([]);
watch(
() => props.artistField,
(value) => {
if (value) {
isId.value = value.id;
void getArrayArtist();
}
}
);
const getArrayArtist = async () => {
artistListOptions.value = [];
const response = (await api({
url: API_PATHS.getArtistDicitionaryOptions,
method: 'GET',
params: {
field: isId.value,
},
setup() {
})) as AxiosResponse<BaseResponseBody<ArtistInfoType[]>>;
if (response.data.error.code === config.API_RES_CODE.OK.code) {
artistListOptions.value = response.data.data;
}
};
const filterFn = (val: string, update: (fn: () => void) => void) => {
if (val === '') {
update(() => {
filteredOptions.value = artistListOptions.value;
});
}
update(() => {
const needle = val.toLowerCase();
filteredOptions.value = artistListOptions?.value.filter((option) => {
return option.fullName.toLowerCase().includes(needle);
});
});
};
const artistNameRules = [
(val?: number) =>
val !== undefined ||
......@@ -225,11 +282,15 @@ export default defineComponent({
(val && val.trim().length) ||
i18n.global.t('managingUnitAdd.validateMessages.requireContractTimeTo'),
];
return {
artistNameRules,
artistFieldRules,
contractTimeFromRules,
contractTimeToRules,
filterFn,
artistListOptions,
filteredOptions,
};
},
emits: [
......
......@@ -8,25 +8,38 @@
<div class="col-2 sreach">
<q-select
v-model="sreachArtist"
:options="artistOptions"
:options="filteredOptions"
option-label="artistName"
option-value="id"
dense
outlined
input-debounce="0"
:label="$t('listBooking.titleColumnsTable.artistName')"
clearable
></q-select>
@filter="filterFn"
use-input
behavior="menu"
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey"> Ko có kết quả </q-item-section>
</q-item>
</template>
</q-select>
</div>
<div class="col-2 sreach">
<q-select
v-model="sreachUserName"
:options="customerOptions"
:options="customerFiltereOption"
option-label="fullName"
option-value="id"
dense
outlined
:label="$t('listBooking.titleColumnsTable.userName')"
clearable
@filter="filterFnCust"
use-input
behavior="menu"
></q-select>
</div>
<div class="col-2 sreach">
......@@ -415,8 +428,10 @@ export default defineComponent({
}
};
const artistOptions: Ref<ListArrayArtist[] | null> = ref([]);
const customerOptions: Ref<ListArrayCust[] | null> = ref([]);
const artistOptions: Ref<ListArrayArtist[]> = ref([]);
const customerOptions: Ref<ListArrayCust[] > = ref([]);
const filteredOptions: Ref<ListArrayArtist[] > = ref([]);
const customerFiltereOption: Ref<ListArrayCust[] > = ref([]);
const getArrayArtist = async () => {
const response = (await api({
......@@ -428,7 +443,19 @@ export default defineComponent({
artistOptions.value = response.data.data;
}
};
const filterFn = (val: string, update: (fn: () => void) => void) => {
if (val === '') {
update(() => {
filteredOptions.value = artistOptions.value;
});
}
update(() => {
const needle = val.toLowerCase()
filteredOptions.value = artistOptions?.value.filter(option => {
return option.artistName.toLowerCase().includes(needle)
})
})
};
const getArrayCust = async () => {
const response = (await api({
url: API_PATHS.getArrayCust,
......@@ -440,6 +467,21 @@ export default defineComponent({
}
};
const filterFnCust = (val: string, update: (fn: () => void) => void) => {
if (val === '') {
update(() => {
customerFiltereOption.value = customerOptions.value;
});
}
update(() => {
const needle = val.toLowerCase()
customerFiltereOption.value = customerOptions?.value.filter(option => {
return option.fullName.toLowerCase().includes(needle)
})
})
}
const getListBooking = async () => {
try {
const response = (await api({
......@@ -508,9 +550,14 @@ export default defineComponent({
});
return {
date,
filterFn,
changeTime,
filterFnCust,
customerOptions,
customerFiltereOption,
artistOptions,
filteredOptions,
detailInfoBooking,
showDialog,
detail,
......
<template>
<q-dialog persistent :model-value="openDialogRefusedBrowser">
<q-card style="min-width: 900px" bordered>
<q-form greedy @submit.prevent="confirmRefusedCustomer">
<q-card-section style="padding-bottom: 10px">
<q-item style="padding-left: 10px">
<q-item-section>
<q-item-label class="text-h6 text-weight-regular"
>Lý do</q-item-label
>
</q-item-section>
</q-item>
</q-card-section>
<q-card-section style="padding-top: 0px">
<q-input
outlined
hide-bottom-space
:rules="contentRules"
v-model="content"
label="Nội dung"
type="textarea"
/>
</q-card-section>
<q-card-actions align="right">
<q-btn
color="grey"
no-caps
style="width: 90px"
label="Hủy"
@click="$emit('click:CloseBtn')"
/>
<q-btn
type="submit"
color="primary"
no-caps
style="width: 90px"
label="Ok"
/>
</q-card-actions>
</q-form>
</q-card>
</q-dialog>
</template>
<script lang="ts">
import { defineComponent, Ref, ref, watch } from 'vue';
import { Dialog, Notify } from 'quasar';
import { API_PATHS, config } from 'src/assets/configurations.example';
import { AxiosResponse } from 'axios';
import { api, BaseResponseBody } from 'src/boot/axios';
// import { emit } from 'cluster';
export default defineComponent({
props: {
openDialogRefusedBrowser: {
type: Boolean,
required: true,
},
id: {
type: Number,
required: true,
},
},
setup(props, context) {
watch(
() => props.openDialogRefusedBrowser,
(value) => {
if (value) {
content.value = null;
}
}
);
const content: Ref<string | null> = ref(null);
const contentRules = [
(val?: string) => (val && val.trim().length) || 'Vui lòng nhập nội dung',
];
const confirmRefusedCustomer = async () => {
try {
const browserResult = (await api({
url: API_PATHS.artistOwnerBrowseManagement,
method: 'POST',
data: {
id: props.id,
approvalStatus: 2,
reasonRefuseApproval: content.value,
},
})) as AxiosResponse<BaseResponseBody<unknown>>;
if (browserResult.data.error.code === config.API_RES_CODE.OK.code) {
Notify.create({
type: 'positive',
message: 'Từ chối duyệt thành công',
actions: [{ icon: 'close', color: 'white' }],
});
context.emit('editReCustomer');
context.emit('click:CloseBtn');
}
} catch (error) {}
};
return {
contentRules,
content,
confirmRefusedCustomer,
};
},
emits: ['click:CloseBtn', 'editReCustomer'],
});
</script>
......@@ -76,6 +76,7 @@
<template v-slot:body-cell-action="item">
<q-td style="padding: 0; text-align: center">
<q-btn
v-if="item.row.approvalStatus === 1"
flat
round
color="primary"
......@@ -87,6 +88,7 @@
}}</q-tooltip>
</q-btn>
<q-btn
v-if="item.row.approvalStatus === 1"
flat
round
color="primary"
......@@ -97,6 +99,30 @@
$t('managingUnit.toolTipMessage.delete')
}}</q-tooltip>
</q-btn>
<!-- duyệt -->
<q-btn
v-if="item.row.approvalStatus === 0"
flat
round
color="primary"
icon="mdi-check-circle-outline"
@click="confirmBrowser(item.row.id)"
>
<q-tooltip :offset="[20, 10]">Duyệt</q-tooltip>
</q-btn>
<q-btn
v-if="item.row.approvalStatus === 0"
flat
round
size="1em"
color="primary"
icon="mdi-block-helper"
@click="confirmRefusedBrowser(item.row.id)"
>
<q-tooltip>Từ chối</q-tooltip>
</q-btn>
</q-td>
</template>
<template v-slot:body-cell-status="rowData">
......@@ -118,6 +144,24 @@
</div>
</q-td>
</template>
<template v-slot:body-cell-approvalStatus="rowData">
<q-td>
<div v-if="rowData.value === 1" align="center">
<q-chip color="positive" text-color="white" size="sm">
Duyệt
</q-chip>
</div>
<div v-if="rowData.value === 0" align="center">
<q-chip color="orange" text-color="white" size="sm"
>Chờ duyệt
</q-chip>
</div>
<div v-if="rowData.value === 2" align="center">
<q-chip color="red" text-color="white" size="sm">Hủy</q-chip>
</div>
</q-td>
</template>
</q-table>
</div>
<div class="col-12 q-mt-sm">
......@@ -168,6 +212,14 @@
v-model:check_artistList="check_artistList"
@addNewUnit="updateNewUnit"
/>
<confirm
:id="isUnitId"
v-model:open-dialog-refused-browser="openConfirm"
@click:CloseBtn="openConfirm = false"
@editReCustomer="getListUnits"
>
</confirm>
</div>
</template>
......@@ -189,11 +241,13 @@ import {
import { config, API_PATHS } from 'src/assets/configurations.example';
import AddUpdateUnitDialog from 'components/units-manager/add-update-unit-dialog/index.vue';
import { UnitStatus } from 'src/assets/enums';
import confirm from '../don-vi-chu-quan/confirm.vue';
export default defineComponent({
components: {
Pagination,
AddUpdateUnitDialog,
confirm,
},
setup() {
//DS đơn vị chủ quản
......@@ -216,8 +270,8 @@ export default defineComponent({
sortable: false,
},
{
name: 'name',
field: 'name',
name: 'unitName',
field: 'unitName',
required: true,
label: i18n.global.t('managingUnit.tableColumns.name'),
headerStyle: 'text-align: center !important;',
......@@ -234,10 +288,10 @@ export default defineComponent({
sortable: false,
},
{
name: 'fields',
field: 'fields',
name: 'classificationName',
field: 'classificationName',
required: true,
label: i18n.global.t('managingUnit.tableColumns.fields'),
label: 'Phân loại',
headerStyle: 'text-align: center !important;',
align: 'left',
sortable: false,
......@@ -269,6 +323,15 @@ export default defineComponent({
align: 'center',
sortable: false,
},
{
name: 'approvalStatus',
field: 'approvalStatus',
required: true,
label: 'T.thái duyệt',
headerStyle: 'text-align: center !important;',
align: 'center',
sortable: false,
},
{
name: 'action',
field: 'action',
......@@ -307,6 +370,50 @@ export default defineComponent({
const unitArtistList: Ref<unknown[]> = ref([]);
const unitId: Ref<number | undefined> = ref(undefined);
const check_artistList = ref(false);
const isUnitId: Ref<number | null> = ref(null);
const openConfirm = ref(false);
const confirmRefusedBrowser = (id: number) => {
isUnitId.value = id;
openConfirm.value = true;
};
const confirmBrowser = (id: number) => {
Dialog.create({
title: i18n.global.t(
'customer.confirmActionsTitle.confirmDeleteUserTitle'
),
message: i18n.global.t('Bạn có chắc muốn duyệt đơn vị quản lý này không?'),
cancel: i18n.global.t(
'customer.confirmActionsTitle.confirmDeleteUserCancelBtnLabel'
),
color: 'negative',
}).onOk(() => {
void browser(id);
});
};
const browser = async (id: number) => {
try {
const deleteResult = (await api({
url: API_PATHS.artistOwnerBrowseManagement,
method: 'POST',
data: {
id: id,
approvalStatus: 1,
reasonRefuseApproval: null,
},
})) as AxiosResponse<BaseResponseBody<unknown>>;
if (deleteResult.data.error.code === config.API_RES_CODE.OK.code) {
Notify.create({
type: 'positive',
message: i18n.global.t('customer.actionMessages.deleteUserAccess'),
actions: [{ icon: 'close', color: 'white' }],
});
void getListUnits();
}
} catch (error) {}
};
const getListUnits = async () => {
try {
......@@ -464,7 +571,6 @@ export default defineComponent({
data,
})) as AxiosResponse<BaseResponseBody<ArtistOwnerAdd[]>>;
if (response.data.error.code === config.API_RES_CODE.OK.code) {
updateUnitDialogIsOpened.value = false;
Notify.create({
......@@ -558,6 +664,11 @@ export default defineComponent({
addNewUnit,
openUpdateUnitDialog,
UnitStatus,
// confirmBrowser,
confirmRefusedBrowser,
isUnitId,
openConfirm,
confirmBrowser,
};
},
});
......
......@@ -6,6 +6,7 @@ export enum Pages {
groupUsers = 'nhom-nguoi-dung',
cmsUser = 'nguoi-dung',
managingUnit = 'don-vi-chu-quan',
// managingUnitBrowsing = 'duyet-don-vi-chu-quan',
artist = 'nghe-sy',
artistBrowsing = 'nghe-sy-cho-duyet',
......@@ -66,6 +67,11 @@ const routes: RouteRecordRaw[] = [
component: () => import('pages/don-vi-chu-quan/index.vue'),
name: Pages.managingUnit,
},
// {
// path: '/duyet-don-vi-chu-quan',
// component: () => import('pages/duyet-don-vi-chu-quan/index.vue'),
// name: Pages.managingUnitBrowsing,
// },
{
path: '/nghe-sy',
component: () => import('pages/nghe-sy/index.vue'),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment