update

parent a4742087
...@@ -14,110 +14,153 @@ export default defineComponent({ ...@@ -14,110 +14,153 @@ export default defineComponent({
artistName: { type: String, required: true }, artistName: { type: String, required: true },
birthday: { type: String, required: true }, birthday: { type: String, required: true },
sex: { type: Number, required: true }, sex: { type: Number, required: true },
nationality: { type: String, required: true }, nationality: { type: Number, required: true },
status: { type: Number, required: true }, status: { type: Number, required: true },
address: { type: String, required: true }, address: { type: String, required: true },
field: { type: String, required: true }, field: { type: Number, required: true },
work: { type: String, required: true }, work: { type: Number, required: true },
qualification: { type: String, required: true }, qualification: { type: Number, required: true },
artistLevel: { type: String, required: true }, artistLevel: { type: Number, required: true },
phoneNumber: { type: String, required: true }, phoneNumber: { type: String, required: true },
email: { type: String, required: true }, email: { type: String, required: true },
facebook: { type: String, required: true }, facebook: { type: String, required: true },
facebookMessage: { type: String, required: true }, facebookMessage: { type: String, required: true },
instagram: { type: String, required: true }, instagram: { type: String, required: true },
whatsapp: { type: String, required: true }, whatsapp: { type: String, required: true },
sexOptions: { type: Array, required: true },
fieldOptions: { type: Array, required: true },
nationalityOptions: { type: Array, required: true },
professionOptions: { type: Array, required: true },
artistLevelOptions: { type: Array, required: true },
workOptions: { type: Array, required: true },
}, },
setup() { setup() {
const userNameRules = [ const artistCodeRules = [
(val?: string) => (val?: string) =>
(val && val.trim().length) || (val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requireUserName'), i18n.global.t(
'artist.artistInformation.validateMessages.requireArtistCode'
),
]; ];
const customerNameRules = [ const fullNameRules = [
(val?: string) => (val?: string) =>
(val && val.trim().length) || (val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requireCustomerName'), i18n.global.t(
'artist.artistInformation.validateMessages.requireFullName'
),
]; ];
const businessNameRules = [ const artistNameRules = [
(val?: string) => (val?: string) =>
(val && val.trim().length) || (val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requireBusinessName'), i18n.global.t(
'artist.artistInformation.validateMessages.requireArtistName'
),
]; ];
const taxCodeRules = [ const birthdayRules = [
(val?: number) => (val?: string) =>
val !== undefined || val !== undefined ||
i18n.global.t('customer.validateMessages.requireTaxCode'), i18n.global.t(
'artist.artistInformation.validateMessages.requireBirthday'
),
]; ];
const phoneRules = [ const emailRules = [
(val?: string) => (val?: string) =>
(val && val.trim().length) || (val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requirePhone'), i18n.global.t('artist.artistInformation.validateMessages.requireEmail'),
(val: string) => (val: string) =>
isMobilePhone(val) || isEmail(val) ||
i18n.global.t('customer.validateMessages.isPhone'), i18n.global.t('artist.artistInformation.validateMessages.isEmail'),
]; ];
const emailRules = [ const addressRules = [
(val?: string) => (val?: string) =>
(val && val.trim().length) || (val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requireEmail'), i18n.global.t(
(val: string) => 'artist.artistInformation.validateMessages.requireAddress'
isEmail(val) || i18n.global.t('customer.validateMessages.isEmail'), ),
]; ];
const addressRules = [ const phoneNumberRules = [
(val?: string) => (val?: string) =>
(val && val.trim().length) || (val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requireAddress'), i18n.global.t(
'artist.artistInformation.validateMessages.requirePhoneNumber'
),
(val: string) =>
isMobilePhone(val) ||
i18n.global.t('artist.artistInformation.validateMessages.isPhone'),
]; ];
const businessTypeRules = [ const sexRules = [
(val?: number) => (val?: number) =>
val !== undefined || val !== undefined ||
i18n.global.t('customer.validateMessages.requireBusinessType'), i18n.global.t('artist.artistInformation.validateMessages.requireSex'),
]; ];
const ratingsRules = [ const nationalityRules = [
(val?: number) => (val?: number) =>
val !== undefined || val !== undefined ||
i18n.global.t('customer.validateMessages.requireRatings'), i18n.global.t(
'artist.artistInformation.validateMessages.requireNationality'
),
]; ];
const representativeRules = [ const fieldRules = [
(val?: string) => (val?: number) =>
(val && val.trim().length) || val !== undefined ||
i18n.global.t('customer.validateMessages.requireRepresentative'), i18n.global.t('artist.artistInformation.validateMessages.requireField'),
]; ];
const positionRules = [ const workRules = [
(val?: string) => (val?: number) =>
(val && val.trim().length) || val !== undefined ||
i18n.global.t('customer.validateMessages.requiredPosition'), i18n.global.t('artist.artistInformation.validateMessages.requiredWork'),
];
const qualificationRules = [
(val?: number) =>
val !== undefined ||
i18n.global.t(
'artist.artistInformation.validateMessages.requireQualification'
),
];
const artistLevelRules = [
(val?: number) =>
val !== undefined ||
i18n.global.t(
'artist.artistInformation.validateMessages.requireArtistLevel'
),
]; ];
return { return {
userNameRules, artistCodeRules,
customerNameRules, fullNameRules,
businessNameRules, artistNameRules,
taxCodeRules, birthdayRules,
emailRules, emailRules,
ratingsRules,
addressRules, addressRules,
businessTypeRules, phoneNumberRules,
representativeRules, sexRules,
positionRules, nationalityRules,
phoneRules, fieldRules,
workRules,
qualificationRules,
artistLevelRules,
}; };
}, },
emits: [ emits: [
'update:isOpenNewArtistDialog', 'update:isOpenNewArtistDialog',
'click:CloseBtn', 'click:CloseBtn',
'update:userName', 'update:artistCode',
'update:customerName', 'update:fullName',
'update:businessName', 'update:artistName',
'update:taxCode', 'update:birthday',
'update:email', 'update:email',
'update:ratings', 'update:facebook',
'update:facebookMessage',
'update:instagram',
'update:whatsapp',
'update:address', 'update:address',
'update:businessType', 'update:phoneNumber',
'update:representative', 'update:sex',
'update:position', 'update:nationality',
'update:phone', 'update:field',
'update:work',
'update:qualification',
'update:artistLevel',
'update:status', 'update:status',
'addNewCustomer', 'addNewArtist',
], ],
}); });
...@@ -269,6 +269,23 @@ export default { ...@@ -269,6 +269,23 @@ export default {
instagram: 'Instagram', instagram: 'Instagram',
whatsapp: 'Whatsapp', whatsapp: 'Whatsapp',
}, },
validateMessages: {
requireArtistCode: 'Vui lòng nhập mã nghệ sỹ',
requireFullName: 'Vui lòng nhập họ tên nghệ sỹ',
requireArtistName: 'Vui lòng nhập nghệ danh',
requireBirthday: 'Vui lòng chọn ngày sinh',
requireEmail: 'Vui lòng nhập email',
isEmail: 'Email không hợp lệ',
requireAddress: 'Vui lòng nhập địa chỉ',
requirePhoneNumber: 'Vui lòng nhập số điện thoại',
isPhone: 'Số điện thoại không hợp lệ',
requireSex: 'Vui lòng chọn giới tính',
requireNationality: 'Vui lòng chọn quốc tịch',
requireField: 'Vui lòng chọn lĩnh vực',
requiredWork: 'Vui lòng chọn công việc',
requireQualification: 'Vui lòng chọn độ chuyên',
requireArtistLevel: 'Vui lòng chọn xếp hạng',
},
}, },
bankAccount: { bankAccount: {
tableColumnsBank: { tableColumnsBank: {
......
...@@ -114,17 +114,17 @@ export default defineComponent({ ...@@ -114,17 +114,17 @@ export default defineComponent({
const pageSize = ref(20); const pageSize = ref(20);
const totalPage = ref(10); const totalPage = ref(10);
const fullNameKeyword = ref(''); const fullNameKeyword = ref('');
const sexOptions = ref([
{ id: 1, name: 'Nam' },
{ id: 2, name: 'Nữ' },
]);
const fieldOptions: Ref<FieldType[]> = ref([]); const fieldOptions: Ref<FieldType[]> = ref([]);
const nationalityOptions: Ref<NationalityType[]> = ref([]);
const professionOptions: Ref<QualificationType[]> = ref([]);
const artistLevelOptions: Ref<ArtistLevelType[]> = ref([]);
const workOptions: Ref<WorkType[]> = ref([]);
const fieldSelected: Ref<number | undefined> = ref(); const fieldSelected: Ref<number | undefined> = ref();
const professionOptions = ref([
{ id: 1, text: 'Chuyên nghiệp' },
{ id: 2, text: 'Nghiệp dư' },
]);
const professionSelected: Ref<number | undefined> = ref(); const professionSelected: Ref<number | undefined> = ref();
const artistLevelOptions = ref([
{ id: 1, text: 'VIP_1' },
{ id: 2, text: 'VIP_2' },
]);
const artistLevelSelected: Ref<number | undefined> = ref(); const artistLevelSelected: Ref<number | undefined> = ref();
const isOpenNewArtistDialog = ref(false); const isOpenNewArtistDialog = ref(false);
...@@ -134,13 +134,13 @@ export default defineComponent({ ...@@ -134,13 +134,13 @@ export default defineComponent({
const artistName: 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<number | undefined> = ref();
const address: Ref<string | undefined> = ref(); const address: Ref<string | undefined> = ref();
const status: Ref<number> = ref(1); const status: Ref<number> = ref(1);
const field: Ref<string | undefined> = ref(); const field: Ref<number | undefined> = ref();
const work: Ref<string | undefined> = ref(); const work: Ref<number | undefined> = ref();
const qualification: Ref<string | undefined> = ref(); const qualification: Ref<number | undefined> = ref();
const artistLevel: Ref<string | undefined> = ref(); const artistLevel: Ref<number | 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();
...@@ -194,19 +194,53 @@ export default defineComponent({ ...@@ -194,19 +194,53 @@ export default defineComponent({
} }
}; };
// const getNationalityOptions = async () => { const getNationalityOptions = async () => {
// const response = (await api({ const response = (await api({
// url: API_PATHS.getFieldOptions, url: API_PATHS.getNationalityOptions,
// method: 'GET', method: 'GET',
// params: {}, params: {},
// })) as AxiosResponse<BaseResponseBody<NationalityType[]>>; })) as AxiosResponse<BaseResponseBody<NationalityType[]>>;
// if (response.data.error.code === config.API_RES_CODE.OK.code) { if (response.data.error.code === config.API_RES_CODE.OK.code) {
// fieldOptions.value = response.data.data; nationalityOptions.value = response.data.data;
// } }
// }; };
const getArtistLevelOptions = async () => {
const response = (await api({
url: API_PATHS.getArtistLevelOptions,
method: 'GET',
params: {},
})) as AxiosResponse<BaseResponseBody<ArtistLevelType[]>>;
if (response.data.error.code === config.API_RES_CODE.OK.code) {
artistLevelOptions.value = response.data.data;
}
};
const getQualificationOptions = async () => {
const response = (await api({
url: API_PATHS.getQualificationOptions,
method: 'GET',
params: {},
})) as AxiosResponse<BaseResponseBody<QualificationType[]>>;
if (response.data.error.code === config.API_RES_CODE.OK.code) {
professionOptions.value = response.data.data;
}
};
const getWorkOptions = async () => {
const response = (await api({
url: API_PATHS.getWorkOptions,
method: 'GET',
params: {},
})) as AxiosResponse<BaseResponseBody<WorkType[]>>;
if (response.data.error.code === config.API_RES_CODE.OK.code) {
workOptions.value = response.data.data;
}
};
onMounted(() => { onMounted(() => {
void getListArtists(); void getListArtists();
void getFieldOptions(); void getFieldOptions();
void getNationalityOptions();
void getArtistLevelOptions();
void getQualificationOptions();
void getWorkOptions();
}); });
return { return {
userTableColumnsArtist, userTableColumnsArtist,
...@@ -234,6 +268,7 @@ export default defineComponent({ ...@@ -234,6 +268,7 @@ export default defineComponent({
facebookMessage, facebookMessage,
instagram, instagram,
whatsapp, whatsapp,
sexOptions,
filterListArtist, filterListArtist,
totalPage, totalPage,
changePageSize, changePageSize,
...@@ -245,6 +280,12 @@ export default defineComponent({ ...@@ -245,6 +280,12 @@ export default defineComponent({
artistLevelSelected, artistLevelSelected,
artistLevelOptions, artistLevelOptions,
getFieldOptions, getFieldOptions,
nationalityOptions,
getNationalityOptions,
workOptions,
getArtistLevelOptions,
getQualificationOptions,
getWorkOptions,
}; };
}, },
}); });
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<q-select <q-select
v-model="professionSelected" v-model="professionSelected"
:options="professionOptions" :options="professionOptions"
option-label="text" option-label="name"
option-value="id" option-value="id"
dense dense
outlined outlined
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
<q-select <q-select
v-model="artistLevelSelected" v-model="artistLevelSelected"
:options="artistLevelOptions" :options="artistLevelOptions"
option-label="text" option-label="name"
option-value="id" option-value="id"
dense dense
outlined outlined
...@@ -101,6 +101,30 @@ ...@@ -101,6 +101,30 @@
</div> </div>
<AddNewArtistDialog <AddNewArtistDialog
v-model:is-open-new-artist-dialog="isOpenNewArtistDialog" v-model:is-open-new-artist-dialog="isOpenNewArtistDialog"
artistCode
v-model:full-name="fullName"
v-model:artist-name="artistName"
v-model:birthday="birthday"
v-model:sex="sex"
v-model:nationality="nationality"
v-model:status="status"
v-model:address="address"
v-model:field="field"
v-model:work="work"
v-model:qualification="qualification"
v-model:artist-level="artistLevel"
v-model:phone-number="phoneNumber"
v-model:email="email"
v-model:facebook="facebook"
v-model:facebook-message="facebookMessage"
v-model:instagram="instagram"
v-model:whatsapp="whatsapp"
:sex-options="sexOptions"
:field-options="fieldOptions"
:nationality-options="nationalityOptions"
:profession-options="professionOptions"
:artist-level-options="artistLevelOptions"
:work-options="workOptions"
@click:CloseBtn="isOpenNewArtistDialog = false" @click:CloseBtn="isOpenNewArtistDialog = false"
></AddNewArtistDialog> ></AddNewArtistDialog>
</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