update

parent 2c1a94f5
...@@ -58,6 +58,7 @@ export type ArtistInfoType = { ...@@ -58,6 +58,7 @@ export type ArtistInfoType = {
nationality: NationalityType; nationality: NationalityType;
rovince: ProvinceType[]; rovince: ProvinceType[];
fields: FieldType[]; fields: FieldType[];
Classifications: ClassificationOptions[];
works: WorkType[]; works: WorkType[];
qualification: QualificationType; qualification: QualificationType;
artistLevel: ArtistLevelType; artistLevel: ArtistLevelType;
...@@ -101,6 +102,16 @@ export type FieldType = { ...@@ -101,6 +102,16 @@ export type FieldType = {
numIndex: number; numIndex: number;
}; };
export type ClassificationOptions = {
id: number;
name: string;
status:number | null;
description: string | null;
numIndex: number;
};
export type NationalityType = { export type NationalityType = {
id: number; id: number;
name: string; name: string;
...@@ -253,6 +264,8 @@ export type DetailUnit = { ...@@ -253,6 +264,8 @@ export type DetailUnit = {
email: string; email: string;
phoneNumber: string; phoneNumber: string;
status: number; status: number;
userName: string;
password: string;
fields: Array<FieldType>; fields: Array<FieldType>;
contracts: Array<Contract>; contracts: Array<Contract>;
}; };
......
...@@ -176,6 +176,9 @@ ...@@ -176,6 +176,9 @@
</q-tabs> </q-tabs>
<q-separator /> <q-separator />
<q-tab-panels v-model="tabContent" animated> <q-tab-panels v-model="tabContent" animated>
<q-tab-panel <q-tab-panel
v-for="(info, index) in languageOptions" v-for="(info, index) in languageOptions"
...@@ -191,7 +194,15 @@ ...@@ -191,7 +194,15 @@
toolbar-toggle-color="yellow-8" toolbar-toggle-color="yellow-8"
toolbar-bg="primary" toolbar-bg="primary"
style="height: 100%" style="height: 100%"
:definitions="{
upload: {
tip: 'Upload to cloud',
icon: 'cloud_upload',
label: 'Upload',
handler: insertImg,
},
}"
:toolbar="[ :toolbar="[
[ [
{ {
...@@ -267,8 +278,7 @@ ...@@ -267,8 +278,7 @@
['undo', 'redo'], ['undo', 'redo'],
['viewsource'], ['viewsource'],
['upload'] ['upload'],
]" ]"
:fonts="{ :fonts="{
arial: 'Arial', arial: 'Arial',
...@@ -282,8 +292,14 @@ ...@@ -282,8 +292,14 @@
}" }"
> >
<template #upload> <template #upload>
<q-btn @click="uploadFile" flat class="text-white" dense size="sm" icon="cloud_upload"> <q-btn
@click="uploadFile"
flat
class="text-white"
dense
size="sm"
icon="cloud_upload"
>
</q-btn> </q-btn>
</template> </template>
</q-editor> </q-editor>
...@@ -317,8 +333,11 @@ ...@@ -317,8 +333,11 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent, PropType, ref } from 'vue'; import { defineComponent, PropType, ref, Ref } from 'vue';
import { i18n } from 'src/boot/i18n'; import { i18n } from 'src/boot/i18n';
import { Editor } from 'react-draft-wysiwyg';
import 'react-draft-wysiwyg/dist/react-draft-wysiwyg.css';
export default defineComponent({ export default defineComponent({
props: { props: {
isOpened: { isOpened: {
...@@ -350,14 +369,10 @@ export default defineComponent({ ...@@ -350,14 +369,10 @@ export default defineComponent({
}, },
}, },
setup(_, context) { methods: {},
setup(_, context) {
// const content = ref(null)
const uploadImage = ref(null); const uploadImage = ref(null);
const uploadFile = () => { const uploadFile = () => {
// eslint-disable-next-line // eslint-disable-next-line
...@@ -366,14 +381,43 @@ export default defineComponent({ ...@@ -366,14 +381,43 @@ export default defineComponent({
uploadImage.value?.click(); uploadImage.value?.click();
}; };
const selectedFile = (value: FileList) => { const selectedFile = (value: FileList) => {
context.emit('SetAvatar', { context.emit('SetAvatar', {
file: value[0], file: value[0],
url: URL.createObjectURL(value[0]), url: URL.createObjectURL(value[0]),
}); });
}; };
const insertImg = () => {
// eslint-disable-next-line
// @ts-ignore
// eslint-disable-next-line
// create an input file element to open file dialog
const input = document.createElement('input');
input.type = 'file';
input.accept = '.png, .jpg'; // file extensions allowed
input.onchange = (e) => {
// const div = `<img src="${url}>`
const files = (<HTMLInputElement & EventTarget>e.target).files;
// eslint-disable-next-line
// @ts-ignore
// eslint-disable-next-line
const url = URL.createObjectURL(files[0]);
// eslint-disable-next-line
// @ts-ignore
// eslint-disable-next-line
document.execCommand(
'insertHTML',
true,
'<div><img src="' + url + '" /></div>'
);
};
input.click();
};
const deleteAvatar = () => { const deleteAvatar = () => {
context.emit('deleteAvatar'); context.emit('deleteAvatar');
}; };
...@@ -402,6 +446,8 @@ export default defineComponent({ ...@@ -402,6 +446,8 @@ export default defineComponent({
const tab = ref('vi'); const tab = ref('vi');
const tabContent = ref('vi'); const tabContent = ref('vi');
const content: Ref<string> = ref('');
return { return {
nameRules, nameRules,
imageRules, imageRules,
...@@ -413,7 +459,10 @@ export default defineComponent({ ...@@ -413,7 +459,10 @@ export default defineComponent({
deleteAvatar, deleteAvatar,
tab, tab,
tabContent, tabContent,
uploadFile content,
uploadFile,
insertImg,
// uploadStory
}; };
}, },
emits: [ emits: [
......
...@@ -419,6 +419,37 @@ export default defineComponent({ ...@@ -419,6 +419,37 @@ export default defineComponent({
}, },
}, },
setup() { setup() {
const selectedFile = () => {
// eslint-disable-next-line
// @ts-ignore
// eslint-disable-next-line
// create an input file element to open file dialog
const input = document.createElement('input');
input.type = 'file';
input.accept = '.png, .jpg'; // file extensions allowed
input.onchange = (e) => {
// const div = `<img src="${url}>`
const files = (<HTMLInputElement & EventTarget>e.target).files;
// eslint-disable-next-line
// @ts-ignore
// eslint-disable-next-line
const url = URL.createObjectURL(files[0]);
// eslint-disable-next-line
// @ts-ignore
// eslint-disable-next-line
document.execCommand(
'insertHTML',
true,
'<div><img src="' + url + '" /></div>'
);
};
input.click();
};
const namePageRules = [ const namePageRules = [
(val?: string) => (val?: string) =>
(val && val.trim().length) || (val && val.trim().length) ||
...@@ -435,6 +466,7 @@ export default defineComponent({ ...@@ -435,6 +466,7 @@ export default defineComponent({
namePageRules, namePageRules,
urlRules, urlRules,
selectedFile,
// nameMenuRules, // nameMenuRules,
// tabNamePage, // tabNamePage,
// tabContent, // tabContent,
......
...@@ -118,9 +118,6 @@ export default defineComponent({ ...@@ -118,9 +118,6 @@ export default defineComponent({
// ]; // ];
// const taxCodeRules = [ // const taxCodeRules = [
// (val?: string) => // (val?: string) =>
// (val && val.trim().length) ||
// i18n.global.t('customer.validateMessages.requireTaxCode'),
// (val?: string) =>
// (val && val.trim().length <= 20) || // (val && val.trim().length <= 20) ||
// i18n.global.t('customer.validateMessages.LengthTaxCode'), // i18n.global.t('customer.validateMessages.LengthTaxCode'),
// ]; // ];
......
...@@ -77,36 +77,46 @@ export default defineComponent({ ...@@ -77,36 +77,46 @@ export default defineComponent({
position.value = props.customerInfo.position; position.value = props.customerInfo.position;
level.value = props.customerInfo.level; level.value = props.customerInfo.level;
}; };
const userNameRules = [ // const userNameRules = [
(val?: string) => // (val?: string) =>
(val && val.trim().length) || // (val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requireUserName'), // i18n.global.t('customer.validateMessages.requireUserName'),
]; // ];
const passwordRules = [ // const passwordRules = [
(val?: string) => // (val?: string) =>
(val && val.trim().length) || // (val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requirePassword'), // i18n.global.t('customer.validateMessages.requirePassword'),
]; // ];
const codeRules = [ const codeRules = [
(val?: string) => (val?: string) =>
(val && val.trim().length) || (val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requireCode'), i18n.global.t('customer.validateMessages.requireCode'),
(val?: string) =>
(val && val.trim().length <= 50) ||
i18n.global.t('customer.validateMessages.lengthCode'),
]; ];
const customerNameRules = [ const customerNameRules = [
(val?: string) => (val?: string) =>
(val && val.trim().length) || (val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requireCustomerName'), i18n.global.t('customer.validateMessages.requireCustomerName'),
];
const businessNameRules = [
(val?: string) => (val?: string) =>
(val && val.trim().length) || (val && val.trim().length <= 50) ||
i18n.global.t('customer.validateMessages.requireBusinessName'), i18n.global.t('customer.validateMessages.lengthCustomerName'),
];
const taxCodeRules = [
(val?: string) =>
(val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requireTaxCode'),
]; ];
// const businessNameRules = [
// (val?: string) =>
// (val && val.trim().length) ||
// i18n.global.t('customer.validateMessages.requireBusinessName'),
// ];
// const taxCodeRules = [
// (val?: string) =>
// (val && val.trim().length) ||
// i18n.global.t('customer.validateMessages.requireTaxCode'),
// ];
const phoneRules = [ const phoneRules = [
(val?: string) => (val?: string) =>
(val && val.trim().length) || (val && val.trim().length) ||
...@@ -122,45 +132,45 @@ export default defineComponent({ ...@@ -122,45 +132,45 @@ export default defineComponent({
(val: string) => (val: string) =>
isEmail(val) || i18n.global.t('customer.validateMessages.isEmail'), isEmail(val) || i18n.global.t('customer.validateMessages.isEmail'),
]; ];
const addressRules = [ // const addressRules = [
(val?: string) => // (val?: string) =>
(val && val.trim().length) || // (val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requireAddress'), // i18n.global.t('customer.validateMessages.requireAddress'),
]; // ];
const businessTypeRules = [ // const businessTypeRules = [
(val?: string) => // (val?: string) =>
(val && val.trim().length) || // (val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requireBusinessType'), // i18n.global.t('customer.validateMessages.requireBusinessType'),
]; // ];
const levelRules = [ // const levelRules = [
(val?: CustomerLevelType) => // (val?: CustomerLevelType) =>
val !== null || // val !== null ||
i18n.global.t('customer.validateMessages.requireRatings'), // i18n.global.t('customer.validateMessages.requireRatings'),
]; // ];
const representativeRules = [ // const representativeRules = [
(val?: string) => // (val?: string) =>
(val && val.trim().length) || // (val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requireRepresentative'), // i18n.global.t('customer.validateMessages.requireRepresentative'),
]; // ];
const positionRules = [ // const positionRules = [
(val?: string) => // (val?: string) =>
(val && val.trim().length) || // (val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requiredPosition'), // i18n.global.t('customer.validateMessages.requiredPosition'),
]; // ];
return { return {
isPwd: ref(true), isPwd: ref(true),
userNameRules, // userNameRules,
customerNameRules, customerNameRules,
businessNameRules, // businessNameRules,
passwordRules, // passwordRules,
codeRules, codeRules,
taxCodeRules, // taxCodeRules,
emailRules, emailRules,
levelRules, // levelRules,
addressRules, // addressRules,
businessTypeRules, // businessTypeRules,
representativeRules, // representativeRules,
positionRules, // positionRules,
phoneRules, phoneRules,
userName, userName,
fullName, fullName,
......
...@@ -31,6 +31,37 @@ ...@@ -31,6 +31,37 @@
> >
<div class="row q-col-gutter-sm"> <div class="row q-col-gutter-sm">
<div class="col-6"> <div class="col-6">
<q-input
:model-value="userName"
@update:model-value="$emit('update:userName', $event)"
:label="`${$t('loginPage.usernameInputLabel')} *`"
:rules="usernameInputRules"
class="q-my-sm"
outlined
clearable
>
</q-input>
<q-input
:model-value="password"
@update:model-value="$emit('update:password', $event)"
:label="`${$t('loginPage.passwordInputLabel')} *`"
:rules="passwordInputRules"
class="q-my-sm"
:type="isPwd ? 'password' : 'text'"
outlined
clearable
>
<template v-slot:append>
<q-icon
:name="isPwd ? 'visibility_off' : 'visibility'"
class="cursor-pointer"
@click="isPwd = !isPwd"
/>
</template>
</q-input>
<q-input <q-input
:model-value="code" :model-value="code"
@update:model-value="$emit('update:code', $event)" @update:model-value="$emit('update:code', $event)"
...@@ -100,10 +131,9 @@ ...@@ -100,10 +131,9 @@
<q-select <q-select
:model-value="fields" :model-value="fields"
@update:model-value="$emit('update:fields', $event)" @update:model-value="$emit('update:fields', $event)"
:label="$t('managingUnit.dialogLabel.fieldLabels.fields')" label="Phân loại"
:options="fieldsOptions" :options="fieldsOptions"
:rules="fieldsRules"
multiple
map-options map-options
option-value="id" option-value="id"
option-label="name" option-label="name"
...@@ -213,15 +243,14 @@ ...@@ -213,15 +243,14 @@
</q-td> </q-td>
</template> </template>
</q-table> </q-table>
{{ check_artistList }}
<div <!-- <div
v-if="check_artistList" v-if="check_artistList"
style="color: #c10015; font-size: 12px" style="color: #c10015; font-size: 12px"
> >
Vui lòng chọn ảnh Vui lòng chọn ảnh
</div> -->
</div> </div>
</div>
<div></div> <div></div>
<!-- ngân hàng --> <!-- ngân hàng -->
...@@ -371,7 +400,7 @@ import { isMobilePhone } from '../../../boot/functions'; ...@@ -371,7 +400,7 @@ import { isMobilePhone } from '../../../boot/functions';
import { API_PATHS } from 'src/assets/configurations.example'; import { API_PATHS } from 'src/assets/configurations.example';
import { AxiosResponse } from 'axios'; import { AxiosResponse } from 'axios';
import { api, BaseResponseBody } from 'src/boot/axios'; import { api, BaseResponseBody } from 'src/boot/axios';
import { FieldType, ArtistInfoType, Contract } from 'src/assets/type'; import { FieldType, ArtistInfoType, Contract, ClassificationOptions } from 'src/assets/type';
import { config } from 'src/assets/configurations.example'; import { config } from 'src/assets/configurations.example';
import UnitAddUpdateArtistDialog from '../unit-add-update-artist/index.vue'; import UnitAddUpdateArtistDialog from '../unit-add-update-artist/index.vue';
import UnitAddUpdateBankAccountDialog from '../unit-add-update-bank-account/index.vue'; import UnitAddUpdateBankAccountDialog from '../unit-add-update-bank-account/index.vue';
...@@ -514,21 +543,26 @@ export default defineComponent({ ...@@ -514,21 +543,26 @@ export default defineComponent({
check_artistList: { type: Boolean, required: true }, check_artistList: { type: Boolean, required: true },
isUpdate: { type: Boolean, default: false }, isUpdate: { type: Boolean, default: false },
fieldsOptions: { type: Array, required: true }, fieldsOptions: { type: Array, required: true },
fields: { type: Number, required: true }, fields: { type: Number, required: true },
code: { type: String, required: true }, code: { type: String, required: true },
name: { type: String, required: true }, name: { type: String, required: true },
representative: { type: String, required: true }, representative: { type: String, required: true },
userName: { type: String, required: true },
password: { type: String, required: true },
email: { type: String, required: true }, email: { type: String, required: true },
address: { type: String, required: true }, address: { type: String, required: true },
phoneNumber: { type: String, required: true }, phoneNumber: { type: String, required: true },
status: { type: Number, required: true }, status: { type: Number, required: true },
artistList: { type: Array as PropType<unknown[]>, required: true }, artistList: { type: Array as PropType<unknown[]>, required: true },
bankAccountList: { type: Array as PropType<unknown[]>, required: true }, bankAccountList: { type: Array as PropType<unknown[]>, required: true },
}, },
setup(props, context) { setup(props, context) {
const addArtistDialogIsOpened = ref(false); const addArtistDialogIsOpened = ref(false);
const updateArtistDialogIsOpened = ref(false); const updateArtistDialogIsOpened = ref(false);
const fieldsAddOptions: Ref<FieldType[]> = ref([]); const fieldsAddOptions: Ref<FieldType[]> = ref([]);
const fieldsOptions: Ref<ClassificationOptions[]> = ref([]);
const artistOptions: Ref<ArtistInfoType[]> = ref([]); const artistOptions: Ref<ArtistInfoType[]> = ref([]);
const artistField: Ref<{ id: number; name: string } | undefined> = const artistField: Ref<{ id: number; name: string } | undefined> =
ref(undefined); ref(undefined);
...@@ -551,6 +585,13 @@ export default defineComponent({ ...@@ -551,6 +585,13 @@ export default defineComponent({
const bankOptions: Ref<number | undefined> = ref(undefined); const bankOptions: Ref<number | undefined> = ref(undefined);
const cardTypeOptions: Ref<number | undefined> = ref(undefined); const cardTypeOptions: Ref<number | undefined> = ref(undefined);
const usernameInputRules = [
(val?: string) => (val && val.trim().length) || 'Vui lòng nhập tài khoản',
];
const passwordInputRules = [
(val?: string) => (val && val.trim().length) || 'Vui lòng nhập mật khẩu',
];
const codeRules = [ const codeRules = [
(val?: string) => (val?: string) =>
(val && val.trim().length) || (val && val.trim().length) ||
...@@ -650,12 +691,12 @@ export default defineComponent({ ...@@ -650,12 +691,12 @@ export default defineComponent({
//gọi api lĩnh vực //gọi api lĩnh vực
const getFieldOptions = async () => { const getFieldOptions = async () => {
const response = (await api({ const response = (await api({
url: API_PATHS.getFieldOptions, url: API_PATHS.getClassificationOptions,
method: 'GET', method: 'GET',
params: {}, params: {},
})) as AxiosResponse<BaseResponseBody<FieldType[]>>; })) as AxiosResponse<BaseResponseBody<ClassificationOptions[]>>;
if (response.data.error.code === config.API_RES_CODE.OK.code) { if (response.data.error.code === config.API_RES_CODE.OK.code) {
fieldsAddOptions.value = response.data.data; fieldsOptions.value = response.data.data;
} }
}; };
...@@ -842,6 +883,12 @@ export default defineComponent({ ...@@ -842,6 +883,12 @@ export default defineComponent({
openAddBankAccountDialog, openAddBankAccountDialog,
updateBankAccountDialogIsOpened, updateBankAccountDialogIsOpened,
updateNewBankAccount, updateNewBankAccount,
usernameInputRules,
passwordInputRules,
isPwd: ref(true),
fieldsOptions,
}; };
}, },
emits: [ emits: [
...@@ -857,6 +904,8 @@ export default defineComponent({ ...@@ -857,6 +904,8 @@ export default defineComponent({
'update:status', 'update:status',
'update:artistList', 'update:artistList',
'update:check_artistList', 'update:check_artistList',
'update:userName',
'update:password',
'addNewUnit', 'addNewUnit',
], ],
}); });
......
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
type="text" type="text"
class="q-my-sm" class="q-my-sm"
outlined outlined
:rules="unitRules"
hide-bottom-space hide-bottom-space
></q-input> ></q-input>
...@@ -127,7 +127,7 @@ ...@@ -127,7 +127,7 @@
@update:model-value="$emit('update:birthday', $event)" @update:model-value="$emit('update:birthday', $event)"
:label="$t('userPage.dialogLabel.fieldLabels.birthday')" :label="$t('userPage.dialogLabel.fieldLabels.birthday')"
outlined outlined
:rules="birthdayRules"
hide-bottom-space hide-bottom-space
> >
<template v-slot:append> <template v-slot:append>
......
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
type="text" type="text"
class="q-my-sm" class="q-my-sm"
outlined outlined
:rules="unitRules"
hide-bottom-space hide-bottom-space
></q-input> ></q-input>
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
@update:model-value="$emit('update:birthday', $event)" @update:model-value="$emit('update:birthday', $event)"
:label="$t('userPage.dialogLabel.fieldLabels.birthday')" :label="$t('userPage.dialogLabel.fieldLabels.birthday')"
outlined outlined
:rules="birthdayRules"
hide-bottom-space hide-bottom-space
> >
<template v-slot:append> <template v-slot:append>
......
...@@ -96,9 +96,9 @@ export default { ...@@ -96,9 +96,9 @@ export default {
mobileNumber: 'Số điện thoại *', mobileNumber: 'Số điện thoại *',
address: 'Địa chỉ', address: 'Địa chỉ',
phoneNumber: 'Số máy bàn', phoneNumber: 'Số máy bàn',
unit: 'Đơn vị phòng ban *', unit: 'Đơn vị phòng ban',
sex: 'Giới tính *', sex: 'Giới tính *',
birthday: 'Ngày sinh *', birthday: 'Ngày sinh',
group: 'Thuộc nhóm *', group: 'Thuộc nhóm *',
scheduleAccess: 'Lịch truy cập', scheduleAccess: 'Lịch truy cập',
status: 'Trạng thái', status: 'Trạng thái',
...@@ -341,7 +341,7 @@ export default { ...@@ -341,7 +341,7 @@ export default {
businessType: 'Loại doanh nghiệp ', businessType: 'Loại doanh nghiệp ',
representative: 'Người đại diện ', representative: 'Người đại diện ',
position: 'Chức vụ ', position: 'Chức vụ ',
phone: 'Số điện thoại ', phone: 'Số điện thoại *',
status: 'Trạng thái', status: 'Trạng thái',
}, },
}, },
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<q-select <q-select
v-model="fieldSelected" v-model="fieldSelected"
:options="fieldsOptions" :options="fieldsOptions"
label="Lĩnh vực" label="Phân loại"
option-label="name" option-label="name"
option-value="id" option-value="id"
dense dense
...@@ -138,6 +138,8 @@ ...@@ -138,6 +138,8 @@
v-model:fields="unitField" v-model:fields="unitField"
v-model:fieldsOptions="fieldsOptions" v-model:fieldsOptions="fieldsOptions"
v-model:name="unitName" v-model:name="unitName"
v-model:userName="unitUserName"
v-model:password="unitPassword"
v-model:phoneNumber="unitPhoneNumber" v-model:phoneNumber="unitPhoneNumber"
v-model:representative="unitRepresentative" v-model:representative="unitRepresentative"
v-model:status="unitStatus" v-model:status="unitStatus"
...@@ -155,6 +157,8 @@ ...@@ -155,6 +157,8 @@
v-model:fields="unitField" v-model:fields="unitField"
v-model:fieldsOptions="fieldsOptions" v-model:fieldsOptions="fieldsOptions"
v-model:name="unitName" v-model:name="unitName"
v-model:userName="unitUserName"
v-model:password="unitPassword"
v-model:phoneNumber="unitPhoneNumber" v-model:phoneNumber="unitPhoneNumber"
v-model:representative="unitRepresentative" v-model:representative="unitRepresentative"
v-model:status="unitStatus" v-model:status="unitStatus"
...@@ -178,6 +182,7 @@ import { ...@@ -178,6 +182,7 @@ import {
FieldType, FieldType,
ArtistOwnerAdd, ArtistOwnerAdd,
DetailUnit, DetailUnit,
ClassificationOptions,
} from 'src/assets/type'; } from 'src/assets/type';
import { config, API_PATHS } from 'src/assets/configurations.example'; import { config, API_PATHS } from 'src/assets/configurations.example';
import AddUpdateUnitDialog from 'components/units-manager/add-update-unit-dialog/index.vue'; import AddUpdateUnitDialog from 'components/units-manager/add-update-unit-dialog/index.vue';
...@@ -279,17 +284,20 @@ export default defineComponent({ ...@@ -279,17 +284,20 @@ export default defineComponent({
const pageSize = ref(20); const pageSize = ref(20);
const totalPage = ref(0); const totalPage = ref(0);
const unitNameKeyword = ref(''); const unitNameKeyword = ref('');
const fieldsOptions: Ref<FieldType[]> = ref([]); const fieldsOptions: Ref<ClassificationOptions[]> = ref([]);
const fieldSelected: Ref<FieldType | undefined> = ref(); const fieldSelected: Ref<FieldType | undefined> = ref();
const addUnitDialogIsOpened = ref(false); const addUnitDialogIsOpened = ref(false);
const updateUnitDialogIsOpened = ref(false); const updateUnitDialogIsOpened = ref(false);
const unitField: Ref<FieldType[] | undefined> = ref(undefined); const unitField: Ref<ClassificationOptions[] | undefined> = ref(undefined);
const unitCode = ref(''); const unitCode = ref('');
const unitName = ref(''); const unitName = ref('');
const unitRepresentative = ref(''); const unitRepresentative = ref('');
const unitEmail = ref(''); const unitEmail = ref('');
const unitAddress = ref(''); const unitAddress = ref('');
const unitPhoneNumber = ref(''); const unitPhoneNumber = ref('');
const unitUserName = ref('');
const unitPassword = ref('');
const unitStatus: Ref<number> = ref(UnitStatus.active); const unitStatus: Ref<number> = ref(UnitStatus.active);
const unitArtistList: Ref<unknown[]> = ref([]); const unitArtistList: Ref<unknown[]> = ref([]);
const unitId: Ref<number | undefined> = ref(undefined); const unitId: Ref<number | undefined> = ref(undefined);
...@@ -304,7 +312,7 @@ export default defineComponent({ ...@@ -304,7 +312,7 @@ export default defineComponent({
pageIndex: pageIndex.value, pageIndex: pageIndex.value,
pageSize: pageSize.value, pageSize: pageSize.value,
name: unitNameKeyword.value, name: unitNameKeyword.value,
fields: fieldSelected.value?.id, classification: fieldSelected.value?.id,
}, },
})) as AxiosResponse<BaseResponseBody<PaginationResponse<ArtistOwner>>>; })) as AxiosResponse<BaseResponseBody<PaginationResponse<ArtistOwner>>>;
if (response.data.error.code === config.API_RES_CODE.OK.code) { if (response.data.error.code === config.API_RES_CODE.OK.code) {
...@@ -323,8 +331,11 @@ export default defineComponent({ ...@@ -323,8 +331,11 @@ export default defineComponent({
unitAddress.value = ''; unitAddress.value = '';
unitPhoneNumber.value = ''; unitPhoneNumber.value = '';
unitArtistList.value = []; unitArtistList.value = [];
unitUserName.value = '';
unitPassword.value = '';
unitStatus.value = UnitStatus.active; unitStatus.value = UnitStatus.active;
addUnitDialogIsOpened.value = true; addUnitDialogIsOpened.value = true;
}; };
const openUpdateUnitDialog = (id: number) => { const openUpdateUnitDialog = (id: number) => {
...@@ -352,6 +363,8 @@ export default defineComponent({ ...@@ -352,6 +363,8 @@ export default defineComponent({
unitStatus.value = response.data.data.status; unitStatus.value = response.data.data.status;
unitArtistList.value = response.data.data.contracts; unitArtistList.value = response.data.data.contracts;
unitField.value = response.data.data.fields; unitField.value = response.data.data.fields;
unitUserName.value = response.data.data.userName;
unitPassword.value = response.data.data.password;
} }
} catch (error) {} } catch (error) {}
}; };
...@@ -405,10 +418,10 @@ export default defineComponent({ ...@@ -405,10 +418,10 @@ export default defineComponent({
//gọi api lĩnh vực //gọi api lĩnh vực
const getFieldOptions = async () => { const getFieldOptions = async () => {
const response = (await api({ const response = (await api({
url: API_PATHS.getFieldOptions, url: API_PATHS.getClassificationOptions,
method: 'GET', method: 'GET',
params: {}, params: {},
})) as AxiosResponse<BaseResponseBody<FieldType[]>>; })) as AxiosResponse<BaseResponseBody<ClassificationOptions[]>>;
if (response.data.error.code === config.API_RES_CODE.OK.code) { if (response.data.error.code === config.API_RES_CODE.OK.code) {
fieldsOptions.value = response.data.data; fieldsOptions.value = response.data.data;
} }
...@@ -424,7 +437,9 @@ export default defineComponent({ ...@@ -424,7 +437,9 @@ export default defineComponent({
email: unitEmail.value, email: unitEmail.value,
phoneNumber: unitPhoneNumber.value, phoneNumber: unitPhoneNumber.value,
status: unitStatus.value, status: unitStatus.value,
fields: unitField.value, classification: unitField.value,
userName: unitUserName.value,
password: unitPassword.value,
contracts: unitArtistList.value, contracts: unitArtistList.value,
}; };
const response = (await api({ const response = (await api({
...@@ -461,7 +476,9 @@ export default defineComponent({ ...@@ -461,7 +476,9 @@ export default defineComponent({
email: unitEmail.value, email: unitEmail.value,
phoneNumber: unitPhoneNumber.value, phoneNumber: unitPhoneNumber.value,
status: unitStatus.value, status: unitStatus.value,
fields: unitField.value, classification: unitField.value,
userName: unitUserName.value,
password: unitPassword.value,
contracts: unitArtistList.value, contracts: unitArtistList.value,
}; };
const response = (await api({ const response = (await api({
...@@ -497,6 +514,7 @@ export default defineComponent({ ...@@ -497,6 +514,7 @@ export default defineComponent({
confirmDeleteManagingUnits, confirmDeleteManagingUnits,
deleteManagingUnits, deleteManagingUnits,
fieldsOptions, fieldsOptions,
status, status,
managingUnitTableColumns, managingUnitTableColumns,
managingUnitTableRows, managingUnitTableRows,
...@@ -514,6 +532,8 @@ export default defineComponent({ ...@@ -514,6 +532,8 @@ export default defineComponent({
unitEmail, unitEmail,
unitAddress, unitAddress,
unitPhoneNumber, unitPhoneNumber,
unitUserName,
unitPassword,
unitStatus, unitStatus,
openAddUnitDialog, openAddUnitDialog,
unitArtistList, unitArtistList,
......
...@@ -11,7 +11,7 @@ import AddNewUserDialogComponent from '../../components/user-management/add-new- ...@@ -11,7 +11,7 @@ import AddNewUserDialogComponent from '../../components/user-management/add-new-
import UpdateUserDialogComponent from '../../components/user-management/update-user-dialog/index.vue'; import UpdateUserDialogComponent from '../../components/user-management/update-user-dialog/index.vue';
import { GroupInfoType } from '../nhom-nguoi-dung/UserGroup'; import { GroupInfoType } from '../nhom-nguoi-dung/UserGroup';
import Pagination from 'components/pagination/index.vue'; import Pagination from 'components/pagination/index.vue';
// import moment from 'moment'; import moment from 'moment';
export default defineComponent({ export default defineComponent({
components: { components: {
...@@ -128,6 +128,7 @@ export default defineComponent({ ...@@ -128,6 +128,7 @@ export default defineComponent({
}, },
})) as AxiosResponse<BaseResponseBody<PaginationResponse<UserObject>>>; })) as AxiosResponse<BaseResponseBody<PaginationResponse<UserObject>>>;
if (response.data.error.code === config.API_RES_CODE.OK.code) { if (response.data.error.code === config.API_RES_CODE.OK.code) {
userTableRows.value = response.data.data.data; userTableRows.value = response.data.data.data;
totalPage.value = response.data.data.totalPages; totalPage.value = response.data.data.totalPages;
} }
...@@ -312,11 +313,11 @@ export default defineComponent({ ...@@ -312,11 +313,11 @@ export default defineComponent({
group.value = response.data.data.groups; group.value = response.data.data.groups;
address.value = userInfo.address as string; address.value = userInfo.address as string;
id.value = userInfo.id; id.value = userInfo.id;
// birthday.value = moment(userInfo.birthday).format('YYYY-MM-DD') as string; birthday.value = moment(userInfo.birthday).format('YYYY-MM-DD') as string;
// birthday.value = moment( birthday.value = moment(
// userInfo.birthday, userInfo.birthday,
// 'DD/MM/YYYY HH:mm:ss' 'DD/MM/YYYY HH:mm:ss'
// ).format('DD/MM/YYYY'); ).format('DD/MM/YYYY');
email.value = userInfo.email as string; email.value = userInfo.email as string;
fullName.value = userInfo.fullName as string; fullName.value = userInfo.fullName as string;
mobileNumber.value = userInfo.mobileNumber as string; mobileNumber.value = userInfo.mobileNumber as string;
...@@ -330,6 +331,7 @@ export default defineComponent({ ...@@ -330,6 +331,7 @@ export default defineComponent({
}; };
const updateUser = async () => { const updateUser = async () => {
try { try {
const response = (await api({ const response = (await api({
url: API_PATHS.updateUser, url: API_PATHS.updateUser,
......
...@@ -38,8 +38,14 @@ ...@@ -38,8 +38,14 @@
<q-table <q-table
:rows="userTableRows" :rows="userTableRows"
:columns="userTableColumns" :columns="userTableColumns"
row-key="name" row-key="userName"
virtual-scroll
separator="cell" separator="cell"
:rows-per-page-label="$t('recordPerPage')"
:pagination="{
rowsPerPage: 0,
}"
wrap-cells
hide-pagination hide-pagination
:no-data-label="$t('emptyData')" :no-data-label="$t('emptyData')"
> >
...@@ -60,7 +66,7 @@ ...@@ -60,7 +66,7 @@
</div> </div>
</q-td> </q-td>
</template> </template>
<template v-slot:body-cell-action="item"> <!-- <template v-slot:body-cell-action="item">
<q-td style="padding: 0" class="flex flex-center"> <q-td style="padding: 0" class="flex flex-center">
<q-btn <q-btn
flat flat
...@@ -96,7 +102,7 @@ ...@@ -96,7 +102,7 @@
}}</q-tooltip> }}</q-tooltip>
</q-btn> </q-btn>
</q-td> </q-td>
</template> </template> -->
</q-table> </q-table>
</div> </div>
<div class="col-12 q-mt-sm"> <div class="col-12 q-mt-sm">
......
...@@ -32,7 +32,7 @@ const selectedPageRoles: Ref<string[]> = ref([]); ...@@ -32,7 +32,7 @@ const selectedPageRoles: Ref<string[]> = ref([]);
const addNewGroupInfo = async ($store: Store<StateInterface>) => { const addNewGroupInfo = async ($store: Store<StateInterface>) => {
try { try {
const response = (await api({ const response = (await api({
// url: API_PATHS.addNewGroupUser, url: API_PATHS.addNewGroupUser,
method: 'POST', method: 'POST',
data: { data: {
group: { group: {
......
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