update

parent cb728696
import { defineComponent, ref, Ref } from 'vue'; import { defineComponent, PropType, ref, Ref } from 'vue';
import { i18n } from 'src/boot/i18n'; import { i18n } from 'src/boot/i18n';
import UploadImage from '../../upload-image/index.vue'; import UploadImage from '../../upload-image/index.vue';
import moment from 'moment'; import moment from 'moment';
import { FieldType } from 'src/assets/type';
export default defineComponent({ export default defineComponent({
props: { props: {
id: { type: Number, required: true }, id: { type: Number, required: true },
...@@ -14,7 +15,7 @@ export default defineComponent({ ...@@ -14,7 +15,7 @@ export default defineComponent({
nationality: { type: Number, 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 },
fields: { type: Array, required: true }, fields: { type: Object as PropType<FieldType>, required: true },
works: { type: Number, required: true }, works: { type: Number, required: true },
qualification: { type: Number, required: true }, qualification: { type: Number, required: true },
artistLevel: { type: Number, required: true }, artistLevel: { type: Number, required: true },
......
...@@ -222,7 +222,6 @@ ...@@ -222,7 +222,6 @@
hide-bottom-space hide-bottom-space
clearable clearable
dense dense
multiple
use-input use-input
use-chips use-chips
></q-select> ></q-select>
...@@ -314,6 +313,7 @@ ...@@ -314,6 +313,7 @@
@update:model-value="$emit('update:phoneNumber', $event)" @update:model-value="$emit('update:phoneNumber', $event)"
:error="phoneNumberRules" :error="phoneNumberRules"
:error-message="errorMessPhoneNumber" :error-message="errorMessPhoneNumber"
type="number"
outlined outlined
dense dense
hide-bottom-space hide-bottom-space
......
...@@ -60,7 +60,6 @@ export default defineComponent({ ...@@ -60,7 +60,6 @@ export default defineComponent({
setup() { setup() {
const route = useRoute(); const route = useRoute();
const tab = ref('information'); const tab = ref('information');
// state open dialog // state open dialog
const isOpenAddAccountBankDialog: Ref<boolean> = ref(false); const isOpenAddAccountBankDialog: Ref<boolean> = ref(false);
const isOpenEditAccountBankDialog: Ref<boolean> = ref(false); const isOpenEditAccountBankDialog: Ref<boolean> = ref(false);
...@@ -99,7 +98,8 @@ export default defineComponent({ ...@@ -99,7 +98,8 @@ export default defineComponent({
const artistLevel: Ref<ArtistLevelType | null> = ref(null); const artistLevel: Ref<ArtistLevelType | null> = ref(null);
const address: Ref<string | null> = ref(null); const address: Ref<string | null> = ref(null);
const status: Ref<number> = ref(1); const status: Ref<number> = ref(1);
const fields: Ref<FieldType[]> = ref([]); const fields: Ref<FieldType | null> = ref(null);
const fieldsPrivate: Ref<FieldType | null> = ref(null);
const works: Ref<WorkType[]> = ref([]); const works: Ref<WorkType[]> = ref([]);
const phoneNumber: Ref<string | null> = ref(null); const phoneNumber: Ref<string | null> = ref(null);
const email: Ref<string | null> = ref(null); const email: Ref<string | null> = ref(null);
...@@ -149,6 +149,22 @@ export default defineComponent({ ...@@ -149,6 +149,22 @@ export default defineComponent({
'artist.artistInformation.validateMessages.requirePhoneNumber' 'artist.artistInformation.validateMessages.requirePhoneNumber'
) )
); );
watch(
() => fields.value,
(value) => {
if (value !== null) {
if (value === fieldsPrivate.value) {
void getWorkOptions();
} else {
void getWorkOptions();
works.value = [];
}
} else {
workOptions.value = [];
works.value = [];
}
}
);
watch( watch(
() => artistCode.value, () => artistCode.value,
(value) => { (value) => {
...@@ -291,7 +307,8 @@ export default defineComponent({ ...@@ -291,7 +307,8 @@ export default defineComponent({
works.value = ArtistInformation.works; works.value = ArtistInformation.works;
artistLevel.value = ArtistInformation.artistLevel; artistLevel.value = ArtistInformation.artistLevel;
sex.value = ArtistInformation.sex; sex.value = ArtistInformation.sex;
fields.value = ArtistInformation.fields; fields.value = ArtistInformation.fields[0];
fieldsPrivate.value = ArtistInformation.fields[0];
bankAccounts.value = ArtistInformation.bankAccounts; bankAccounts.value = ArtistInformation.bankAccounts;
products.value = ArtistInformation.products; products.value = ArtistInformation.products;
banners.value = ArtistInformation.banners || []; banners.value = ArtistInformation.banners || [];
...@@ -355,13 +372,14 @@ export default defineComponent({ ...@@ -355,13 +372,14 @@ export default defineComponent({
url: API_PATHS.getWorkOptions, url: API_PATHS.getWorkOptions,
method: 'GET', method: 'GET',
params: { params: {
// fieldId: fields.value[0].id, fieldId: fields.value?.id,
}, },
})) as AxiosResponse<BaseResponseBody<WorkType[]>>; })) as AxiosResponse<BaseResponseBody<WorkType[]>>;
if (response.data.error.code === config.API_RES_CODE.OK.code) { if (response.data.error.code === config.API_RES_CODE.OK.code) {
workOptions.value = response.data.data; workOptions.value = response.data.data;
} }
}; };
const getBankOptions = async () => { const getBankOptions = async () => {
const response = (await api({ const response = (await api({
url: API_PATHS.bankOptions, url: API_PATHS.bankOptions,
...@@ -618,13 +636,13 @@ export default defineComponent({ ...@@ -618,13 +636,13 @@ export default defineComponent({
); );
} }
if (!isMobilePhone(phoneNumber.value as string)) { // if (!isMobilePhone(phoneNumber.value as string)) {
hasError = true; // hasError = true;
phoneNumberRules.value = true; // phoneNumberRules.value = true;
errorMessPhoneNumber.value = i18n.global.t( // errorMessPhoneNumber.value = i18n.global.t(
'artist.artistInformation.validateMessages.isPhone' // 'artist.artistInformation.validateMessages.isPhone'
); // );
} // }
if (!email.value || !email.value?.trim().length) { if (!email.value || !email.value?.trim().length) {
hasError = true; hasError = true;
emailRules.value = true; emailRules.value = true;
...@@ -632,19 +650,19 @@ export default defineComponent({ ...@@ -632,19 +650,19 @@ export default defineComponent({
'artist.artistInformation.validateMessages.requireEmail' 'artist.artistInformation.validateMessages.requireEmail'
); );
} }
if (!isEmail(email.value as string)) { // if (!isEmail(email.value as string)) {
hasError = true; // hasError = true;
emailRules.value = true; // emailRules.value = true;
errorMessEmail.value = i18n.global.t( // errorMessEmail.value = i18n.global.t(
'artist.artistInformation.validateMessages.isEmail' // 'artist.artistInformation.validateMessages.isEmail'
); // );
} // }
if (artistLevel.value === null) { if (artistLevel.value === null) {
hasError = true; hasError = true;
artistLevelRules.value = true; artistLevelRules.value = true;
} }
if (!fields.value.length) { if (!fields.value) {
hasError = true; hasError = true;
fieldRules.value = true; fieldRules.value = true;
} }
...@@ -712,7 +730,7 @@ export default defineComponent({ ...@@ -712,7 +730,7 @@ export default defineComponent({
account: null, account: null,
socialEmbedded: socialEmbedded.value, socialEmbedded: socialEmbedded.value,
artistLevel: artistLevel.value, artistLevel: artistLevel.value,
fields: fields.value, fields: [fields.value],
nationality: nationality.value, nationality: nationality.value,
qualification: qualification.value, qualification: qualification.value,
works: works.value, works: works.value,
...@@ -752,7 +770,7 @@ export default defineComponent({ ...@@ -752,7 +770,7 @@ export default defineComponent({
void getNationalityOptions(); void getNationalityOptions();
void getArtistLevelOptions(); void getArtistLevelOptions();
void getQualificationOptions(); void getQualificationOptions();
void getWorkOptions();
void getBankOptions(); void getBankOptions();
void getTypeCardOptions(); void getTypeCardOptions();
}); });
......
...@@ -97,7 +97,7 @@ export default defineComponent({ ...@@ -97,7 +97,7 @@ export default defineComponent({
const artistLevel: Ref<ArtistLevelType | null> = ref(null); const artistLevel: Ref<ArtistLevelType | null> = ref(null);
const address: Ref<string | null> = ref(null); const address: Ref<string | null> = ref(null);
const status: Ref<number> = ref(1); const status: Ref<number> = ref(1);
const fields: Ref<FieldType[]> = ref([]); const fields: Ref<FieldType | null> = ref(null);
const works: Ref<WorkType[]> = ref([]); const works: Ref<WorkType[]> = ref([]);
const phoneNumber: Ref<string | null> = ref(null); const phoneNumber: Ref<string | null> = ref(null);
const email: Ref<string | null> = ref(null); const email: Ref<string | null> = ref(null);
...@@ -147,6 +147,18 @@ export default defineComponent({ ...@@ -147,6 +147,18 @@ export default defineComponent({
'artist.artistInformation.validateMessages.requirePhoneNumber' 'artist.artistInformation.validateMessages.requirePhoneNumber'
) )
); );
watch(
() => fields.value,
(value) => {
if (value !== null) {
void getWorkOptions();
works.value = [];
} else {
workOptions.value = [];
works.value = [];
}
}
);
watch( watch(
() => artistCode.value, () => artistCode.value,
(value) => { (value) => {
...@@ -299,7 +311,7 @@ export default defineComponent({ ...@@ -299,7 +311,7 @@ export default defineComponent({
url: API_PATHS.getWorkOptions, url: API_PATHS.getWorkOptions,
method: 'GET', method: 'GET',
params: { params: {
// fieldId: fields.value[0].id, fieldId: fields.value?.id,
}, },
})) as AxiosResponse<BaseResponseBody<WorkType[]>>; })) as AxiosResponse<BaseResponseBody<WorkType[]>>;
if (response.data.error.code === config.API_RES_CODE.OK.code) { if (response.data.error.code === config.API_RES_CODE.OK.code) {
...@@ -593,7 +605,7 @@ export default defineComponent({ ...@@ -593,7 +605,7 @@ export default defineComponent({
hasError = true; hasError = true;
artistLevelRules.value = true; artistLevelRules.value = true;
} }
if (!fields.value.length) { if (!fields.value) {
hasError = true; hasError = true;
fieldRules.value = true; fieldRules.value = true;
} }
...@@ -693,7 +705,6 @@ export default defineComponent({ ...@@ -693,7 +705,6 @@ export default defineComponent({
void getNationalityOptions(); void getNationalityOptions();
void getArtistLevelOptions(); void getArtistLevelOptions();
void getQualificationOptions(); void getQualificationOptions();
void getWorkOptions();
void getBankOptions(); void getBankOptions();
void getTypeCardOptions(); void getTypeCardOptions();
}); });
......
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