call API get List Aritsts

parent 82429c15
...@@ -33,4 +33,5 @@ export enum API_PATHS { ...@@ -33,4 +33,5 @@ export enum API_PATHS {
getUserDetail = '/user/detail', getUserDetail = '/user/detail',
updateUser = '/user/update', updateUser = '/user/update',
getListUnits = '/unit/list', getListUnits = '/unit/list',
getListArtists = '/artist',
} }
...@@ -27,3 +27,25 @@ export type UserObject = { ...@@ -27,3 +27,25 @@ export type UserObject = {
updateTime: null | string; updateTime: null | string;
updateBy: null | string; updateBy: null | string;
}; };
export type ArtistInfoType = {
id: number;
artistCode: string;
fullName: string;
artistName: string | null;
birthday: string | null;
sex: number;
nationality: string;
address: string | null;
status: number;
field: string | null;
work: string | null;
qualification: string | null;
artistLevel: string | null;
phoneNumber: string | null;
email: string | null;
facebook: string | null;
facebookMessage: string | null;
instagram: string | null;
whatsapp: string | null;
};
...@@ -4,7 +4,7 @@ export default defineComponent({ ...@@ -4,7 +4,7 @@ export default defineComponent({
id: { type: Number, required: true }, id: { type: Number, required: true },
artistCode: { type: String, required: true }, artistCode: { type: String, required: true },
fullName: { type: String, required: true }, fullName: { type: String, required: true },
stageName: { type: String, default: '' }, artistName: { type: String, default: '' },
birthday: { type: String, default: '' }, birthday: { type: String, default: '' },
sex: { type: Number, required: true }, sex: { type: Number, required: true },
nationality: { type: String, default: '' }, nationality: { type: String, default: '' },
...@@ -12,8 +12,8 @@ export default defineComponent({ ...@@ -12,8 +12,8 @@ export default defineComponent({
status: { type: Number, required: true }, status: { type: Number, required: true },
field: { type: String, default: '' }, field: { type: String, default: '' },
work: { type: String, default: '' }, work: { type: String, default: '' },
professionalism: { type: String, default: '' }, qualification: { type: String, default: '' },
rating: { type: String, default: '' }, artistLevel: { type: String, default: '' },
phoneNumber: { type: String, default: '' }, phoneNumber: { type: String, default: '' },
email: { type: String, default: '' }, email: { type: String, default: '' },
facebook: { type: String, default: '' }, facebook: { type: String, default: '' },
...@@ -23,7 +23,7 @@ export default defineComponent({ ...@@ -23,7 +23,7 @@ export default defineComponent({
}, },
emits: [ emits: [
'update:fullName', 'update:fullName',
'update:stageName', 'update:artistName',
'update:birthday', 'update:birthday',
'update:sex', 'update:sex',
'update:nationality', 'update:nationality',
...@@ -31,8 +31,8 @@ export default defineComponent({ ...@@ -31,8 +31,8 @@ export default defineComponent({
'update:status', 'update:status',
'update:field', 'update:field',
'update:work', 'update:work',
'update:professionalism', 'update:qualification',
'update:rating', 'update:artistLevel',
'update:phoneNumber', 'update:phoneNumber',
'update:email', 'update:email',
'update:facebook', 'update:facebook',
......
...@@ -29,12 +29,12 @@ ...@@ -29,12 +29,12 @@
</div> </div>
<div class="row q-mt-md flex-center"> <div class="row q-mt-md flex-center">
<div class="col-3 text-weight-medium"> <div class="col-3 text-weight-medium">
{{ $t('artist.artistInformation.titleDataField.stageName') }} {{ $t('artist.artistInformation.titleDataField.artistName') }}
</div> </div>
<div class="col-8"> <div class="col-8">
<q-input <q-input
:model-value="stageName" :model-value="artistName"
@update:model-value="$emit('update:stageName', $event)" @update:model-value="$emit('update:artistName', $event)"
outlined outlined
dense dense
></q-input> ></q-input>
...@@ -136,12 +136,12 @@ ...@@ -136,12 +136,12 @@
</div> </div>
<div class="row q-mt-sm flex-center"> <div class="row q-mt-sm flex-center">
<div class="col-3 text-weight-medium"> <div class="col-3 text-weight-medium">
{{ $t('artist.artistInformation.titleDataField.professionalism') }} {{ $t('artist.artistInformation.titleDataField.qualification') }}
</div> </div>
<div class="col-8"> <div class="col-8">
<q-select <q-select
:model-value="professionalism" :model-value="qualification"
@update:model-value="$emit('update:professionalism', $event)" @update:model-value="$emit('update:qualification', $event)"
outlined outlined
dense dense
></q-select> ></q-select>
...@@ -149,12 +149,12 @@ ...@@ -149,12 +149,12 @@
</div> </div>
<div class="row q-mt-sm flex-center"> <div class="row q-mt-sm flex-center">
<div class="col-3 text-weight-medium"> <div class="col-3 text-weight-medium">
{{ $t('artist.artistInformation.titleDataField.rating') }} {{ $t('artist.artistInformation.titleDataField.artistLevel') }}
</div> </div>
<div class="col-8"> <div class="col-8">
<q-select <q-select
:model-value="rating" :model-value="artistLevel"
@update:model-value="$emit('update:rating', $event)" @update:model-value="$emit('update:artistLevel')"
outlined outlined
dense dense
></q-select> ></q-select>
......
...@@ -225,15 +225,14 @@ export default { ...@@ -225,15 +225,14 @@ export default {
artist: { artist: {
tableColumnsArtist: { tableColumnsArtist: {
artistName: 'Tên nghệ sỹ',
artistCode: 'Mã nghệ sỹ', artistCode: 'Mã nghệ sỹ',
fullName: 'Họ tên', fullName: 'Họ tên',
stageName: 'Nghệ danh', artistName: 'Nghệ danh',
avatar: 'Avatar', avatar: 'Avatar',
linhvuc: 'Lĩnh vực', field: 'Lĩnh vực',
work: 'Công việc', work: 'Công việc',
dochuyen: 'Độ chuyên', qualification: 'Độ chuyên',
ratings: 'Xếp hạng', artistLevel: 'Xếp hạng',
action: 'Chức năng', action: 'Chức năng',
}, },
artistInformation: { artistInformation: {
...@@ -247,7 +246,7 @@ export default { ...@@ -247,7 +246,7 @@ export default {
id: 'ID', id: 'ID',
artistCode: 'Mã nghệ sỹ', artistCode: 'Mã nghệ sỹ',
fullName: 'Họ tên', fullName: 'Họ tên',
stageName: 'Nghệ danh', artistName: 'Nghệ danh',
birthday: 'Ngày sinh', birthday: 'Ngày sinh',
sex: 'Giới tính', sex: 'Giới tính',
nationality: 'Quốc tịch', nationality: 'Quốc tịch',
...@@ -255,8 +254,8 @@ export default { ...@@ -255,8 +254,8 @@ export default {
status: 'Trạng thái', status: 'Trạng thái',
field: 'Lĩnh vực', field: 'Lĩnh vực',
work: 'Công việc', work: 'Công việc',
professionalism: 'Độ chuyên', qualification: 'Độ chuyên',
rating: 'Xếp hạng', artistLevel: 'Xếp hạng',
phoneNumber: 'Số điện thoại', phoneNumber: 'Số điện thoại',
email: 'Email', email: 'Email',
facebook: 'FB Page', facebook: 'FB Page',
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
:id="id" :id="id"
:artist-code="artistCode" :artist-code="artistCode"
v-model:full-name="fullName" v-model:full-name="fullName"
v-model:stage-name="stageName" v-model:artist-name="artistName"
v-model:birthday="birthday" v-model:birthday="birthday"
v-model:sex="sex" v-model:sex="sex"
v-model:nationality="nationality" v-model:nationality="nationality"
...@@ -45,8 +45,8 @@ ...@@ -45,8 +45,8 @@
v-model:status="status" v-model:status="status"
v-model:field="field" v-model:field="field"
v-model:work="work" v-model:work="work"
v-model:professionalism="professionalism" v-model:qualification="qualification"
v-model:rating="rating" v-model:artist-level="artistLevel"
v-model:phone-number="phoneNumber" v-model:phone-number="phoneNumber"
v-model:email="email" v-model:email="email"
v-model:facebook="facebook" v-model:facebook="facebook"
......
...@@ -10,28 +10,6 @@ import BankAccount from '../../components/artist-information/bank-account/index. ...@@ -10,28 +10,6 @@ import BankAccount from '../../components/artist-information/bank-account/index.
import HotProduct from '../../components/artist-information/hot-product/index.vue'; import HotProduct from '../../components/artist-information/hot-product/index.vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
export type ArtistInfoType = {
id: number;
artistCode: string;
fullName: string;
stageName: string | null;
birthday: string | null;
sex: number;
nationality: string;
address: string | null;
status: number;
field: string | null;
work: string | null;
professionalism: string | null;
rating: string | null;
phoneNumber: string | null;
email: string | null;
facebook: string | null;
facebookMessage: string | null;
instagram: string | null;
whatsapp: string | null;
};
export default defineComponent({ export default defineComponent({
components: { components: {
PersonalInformation, PersonalInformation,
...@@ -58,7 +36,7 @@ export default defineComponent({ ...@@ -58,7 +36,7 @@ export default defineComponent({
const id: Ref<number> = ref(0); const id: Ref<number> = ref(0);
const artistCode: Ref<string> = ref(''); const artistCode: Ref<string> = ref('');
const fullName: Ref<string> = ref(''); const fullName: Ref<string> = ref('');
const stageName: Ref<string | undefined> = ref(); const artistName: Ref<string | undefined> = ref();
const birthday: Ref<string | undefined> = ref(); const birthday: Ref<string | undefined> = ref();
const sex: Ref<number | undefined> = ref(); const sex: Ref<number | undefined> = ref();
const nationality: Ref<string | undefined> = ref(); const nationality: Ref<string | undefined> = ref();
...@@ -66,8 +44,8 @@ export default defineComponent({ ...@@ -66,8 +44,8 @@ export default defineComponent({
const status: Ref<number> = ref(1); const status: Ref<number> = ref(1);
const field: Ref<string | undefined> = ref(); const field: Ref<string | undefined> = ref();
const work: Ref<string | undefined> = ref(); const work: Ref<string | undefined> = ref();
const professionalism: Ref<string | undefined> = ref(); const qualification: Ref<string | undefined> = ref();
const rating: Ref<string | undefined> = ref(); const artistLevel: Ref<string | undefined> = ref();
const phoneNumber: Ref<string | undefined> = ref(); const phoneNumber: Ref<string | undefined> = ref();
const email: Ref<string | undefined> = ref(); const email: Ref<string | undefined> = ref();
const facebook: Ref<string | undefined> = ref(); const facebook: Ref<string | undefined> = ref();
...@@ -96,8 +74,8 @@ export default defineComponent({ ...@@ -96,8 +74,8 @@ export default defineComponent({
status: 1, status: 1,
field: 'Âm nhạc', field: 'Âm nhạc',
work: 'Ca sỹ', work: 'Ca sỹ',
professionalism: 'Chuyên nghiệp', qualification: 'Chuyên nghiệp',
rating: 'Vip_1', artistLevel: 'Vip_1',
phoneNumber: '09999999999', phoneNumber: '09999999999',
email: 'sontung@gmail.com', email: 'sontung@gmail.com',
facebook: '', facebook: '',
...@@ -108,7 +86,7 @@ export default defineComponent({ ...@@ -108,7 +86,7 @@ export default defineComponent({
artistCode.value = fakeData.artistCode; artistCode.value = fakeData.artistCode;
fullName.value = fakeData.fullName; fullName.value = fakeData.fullName;
stageName.value = fakeData.stageName; artistName.value = fakeData.stageName;
birthday.value = fakeData.birthday; birthday.value = fakeData.birthday;
sex.value = fakeData.sex; sex.value = fakeData.sex;
nationality.value = fakeData.nationality; nationality.value = fakeData.nationality;
...@@ -116,8 +94,8 @@ export default defineComponent({ ...@@ -116,8 +94,8 @@ export default defineComponent({
status.value = fakeData.status; status.value = fakeData.status;
field.value = fakeData.field; field.value = fakeData.field;
work.value = fakeData.work; work.value = fakeData.work;
professionalism.value = fakeData.professionalism; qualification.value = fakeData.qualification;
rating.value = fakeData.rating; artistLevel.value = fakeData.artistLevel;
phoneNumber.value = fakeData.phoneNumber; phoneNumber.value = fakeData.phoneNumber;
email.value = fakeData.email; email.value = fakeData.email;
facebook.value = fakeData.facebook; facebook.value = fakeData.facebook;
...@@ -135,7 +113,7 @@ export default defineComponent({ ...@@ -135,7 +113,7 @@ export default defineComponent({
id, id,
artistCode, artistCode,
fullName, fullName,
stageName, artistName,
birthday, birthday,
sex, sex,
nationality, nationality,
...@@ -143,8 +121,8 @@ export default defineComponent({ ...@@ -143,8 +121,8 @@ export default defineComponent({
status, status,
field, field,
work, work,
professionalism, qualification,
rating, artistLevel,
phoneNumber, phoneNumber,
email, email,
facebook, facebook,
......
...@@ -230,11 +230,14 @@ export default defineComponent({ ...@@ -230,11 +230,14 @@ export default defineComponent({
// } // }
// })) // }))
// gọi api lấy chi tiết sau đấy gán giá trị api trả về gán cho các biến userName customerName businessName taxCode... // gọi api lấy chi tiết sau đấy gán giá trị api trả về gán cho các biến userName customerName businessName taxCode...
// userName.value = response.data.data.userName const fakeDataDetail = {
userName: 'Sơn Tùng',
};
userName.value = fakeDataDetail.userName;
// Tương tự các biến còn lại // Tương tự các biến còn lại
}; };
const openUpdateCustomerDialog = (id: number) => { const openUpdateCustomerDialog = (id: number) => {
showDialogUpdate.value = false; showDialogUpdate.value = true;
console.log(id, 'iddd'); console.log(id, 'iddd');
void getDetailCustomer(id); void getDetailCustomer(id);
}; };
......
import { i18n } from 'src/boot/i18n'; import { i18n } from 'src/boot/i18n';
import { defineComponent, onMounted, ref, Ref } from 'vue'; import { defineComponent, onMounted, ref, Ref } from 'vue';
import { PaginationResponse, ArtistInfoType } from 'src/assets/type';
import Pagination from 'components/pagination/index.vue'; import Pagination from 'components/pagination/index.vue';
import { api, BaseResponseBody } from 'src/boot/axios';
import { API_PATHS, config } from 'src/assets/configurations';
import { AxiosResponse } from 'axios';
export default defineComponent({ export default defineComponent({
components: { components: {
Pagination, Pagination,
...@@ -33,10 +37,10 @@ export default defineComponent({ ...@@ -33,10 +37,10 @@ export default defineComponent({
sortable: false, sortable: false,
}, },
{ {
name: 'stageName', name: 'artistName',
field: 'stageName', field: 'artistName',
required: true, required: true,
label: i18n.global.t('artist.tableColumnsArtist.stageName'), label: i18n.global.t('artist.tableColumnsArtist.artistName'),
headerStyle: 'text-align: center !important;', headerStyle: 'text-align: center !important;',
align: 'left', align: 'left',
sortable: false, sortable: false,
...@@ -51,10 +55,10 @@ export default defineComponent({ ...@@ -51,10 +55,10 @@ export default defineComponent({
sortable: false, sortable: false,
}, },
{ {
name: 'linhvuc', name: 'field',
field: 'linhvuc', field: 'field',
required: true, required: true,
label: i18n.global.t('artist.tableColumnsArtist.linhvuc'), label: i18n.global.t('artist.tableColumnsArtist.field'),
headerStyle: 'text-align: center !important;', headerStyle: 'text-align: center !important;',
align: 'left', align: 'left',
sortable: false, sortable: false,
...@@ -69,19 +73,19 @@ export default defineComponent({ ...@@ -69,19 +73,19 @@ export default defineComponent({
sortable: false, sortable: false,
}, },
{ {
name: 'dochuyen', name: 'qualification',
field: 'dochuyen', field: 'qualification',
required: true, required: true,
label: i18n.global.t('artist.tableColumnsArtist.dochuyen'), label: i18n.global.t('artist.tableColumnsArtist.qualification'),
headerStyle: 'text-align: center !important;', headerStyle: 'text-align: center !important;',
align: 'left', align: 'left',
sortable: false, sortable: false,
}, },
{ {
name: 'ratings', name: 'artistLevel',
field: 'ratings', field: 'artistLevel',
required: true, required: true,
label: i18n.global.t('artist.tableColumnsArtist.ratings'), label: i18n.global.t('artist.tableColumnsArtist.artistLevel'),
headerStyle: 'text-align: center !important;', headerStyle: 'text-align: center !important;',
align: 'left', align: 'left',
sortable: false, sortable: false,
...@@ -111,34 +115,31 @@ export default defineComponent({ ...@@ -111,34 +115,31 @@ export default defineComponent({
{ id: 2, text: 'Nghiệp dư' }, { id: 2, text: 'Nghiệp dư' },
]); ]);
const professionSelected: Ref<number | undefined> = ref(); const professionSelected: Ref<number | undefined> = ref();
const ratingOptions = ref([ const artistLevelOptions = ref([
{ id: 1, text: 'VIP_1' }, { id: 1, text: 'VIP_1' },
{ id: 2, text: 'VIP_2' }, { id: 2, text: 'VIP_2' },
]); ]);
const ratingSelected: Ref<number | undefined> = ref(); const artistLevelSelected: Ref<number | undefined> = ref();
const getListArtist = () => {
// const response = (await api({ const getListArtists = async () => {
// url: API_PATHS.getListArtist, try {
// method: 'GET', const response = (await api({
// params: { url: API_PATHS.getListArtists,
// pageIndex: pageIndex.value, method: 'GET',
// pageSize: pageSize.value, params: {
// }, pageIndex: pageIndex.value,
// })) as AxiosResponse<BaseResponseBody<unknown>>; pageSize: pageSize.value,
const fakeData: unknown[] = [
{
id: 1,
artistCode: '0001',
fullName: 'Nguyễn Tùng Dương',
stageName: 'Tùng Dương',
avatar: '',
linhvuc: 'Âm nhạc',
work: 'Ca sĩ',
dochuyen: 'Chuyên nghiệp',
ratings: 'VIP_1',
}, },
]; })) as AxiosResponse<
userTableRowsArtist.value = fakeData; BaseResponseBody<PaginationResponse<ArtistInfoType>>
>;
if (response.data.error.code === config.API_RES_CODE.OK.code) {
userTableRowsArtist.value = response.data.data.data;
totalPage.value = response.data.data.totalPages;
console.log(response.data.data);
}
} catch (error) {}
// userTableRowsArtist.value = fakeData;
}; };
const filterListArtist = () => { const filterListArtist = () => {
// const response = (await api({ // const response = (await api({
...@@ -153,15 +154,15 @@ export default defineComponent({ ...@@ -153,15 +154,15 @@ export default defineComponent({
}; };
const changePageSize = () => { const changePageSize = () => {
pageIndex.value = 1; pageIndex.value = 1;
void getListArtist(); void getListArtists();
}; };
onMounted(() => { onMounted(() => {
void getListArtist(); void getListArtists();
}); });
return { return {
userTableColumnsArtist, userTableColumnsArtist,
userTableRowsArtist, userTableRowsArtist,
getListArtist, getListArtists,
pageIndex, pageIndex,
pageSize, pageSize,
filterListArtist, filterListArtist,
...@@ -173,8 +174,8 @@ export default defineComponent({ ...@@ -173,8 +174,8 @@ export default defineComponent({
fieldOptions, fieldOptions,
professionSelected, professionSelected,
professionOptions, professionOptions,
ratingSelected, artistLevelSelected,
ratingOptions, artistLevelOptions,
}; };
}, },
}); });
...@@ -33,8 +33,8 @@ ...@@ -33,8 +33,8 @@
</div> </div>
<div class="col-2" dense outlined> <div class="col-2" dense outlined>
<q-select <q-select
v-model="ratingSelected" v-model="artistLevelSelected"
:options="ratingOptions" :options="artistLevelOptions"
option-label="text" option-label="text"
option-value="id" option-value="id"
dense dense
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
</q-btn> </q-btn>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<q-btn color="primary" no-caps :label="$t('crudActions.add')"> </q-btn> <q-btn color="primary" no-caps :label="$t('crudActions.add')"></q-btn>
</div> </div>
<div class="col-12 q-mt-sm"> <div class="col-12 q-mt-sm">
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
v-model:pageSize="pageSize" v-model:pageSize="pageSize"
:totalPage="totalPage" :totalPage="totalPage"
@update:pageSize="changePageSize" @update:pageSize="changePageSize"
@update:currentPage="getListArtist" @update:currentPage="getListArtists"
/> />
</div> </div>
</div> </div>
......
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