search and updateCustomer in customer feature

parent c056aab7
...@@ -3,6 +3,7 @@ import { defineComponent, onMounted, ref, Ref } from 'vue'; ...@@ -3,6 +3,7 @@ import { defineComponent, onMounted, ref, Ref } from 'vue';
import Pagination from 'components/pagination/index.vue'; import Pagination from 'components/pagination/index.vue';
import AddNewCustomerDialogComponent from '../../components/customer/add-new-customer-dialog/index.vue'; import AddNewCustomerDialogComponent from '../../components/customer/add-new-customer-dialog/index.vue';
import UpdateNewCustomerDialogComponent from '../../components/customer/update-new-customer-dialog/index.vue'; import UpdateNewCustomerDialogComponent from '../../components/customer/update-new-customer-dialog/index.vue';
// import { API_PATHS } from 'src/assets/configurations.example';
export type ArtistInfoType = { export type ArtistInfoType = {
id: number; id: number;
userName: string | null; userName: string | null;
...@@ -183,15 +184,16 @@ export default defineComponent({ ...@@ -183,15 +184,16 @@ export default defineComponent({
userTableRowsCustomer.value = fakeData; userTableRowsCustomer.value = fakeData;
}; };
const filterListCustomer = () => { const filterListCustomer = () => {
// const response = (await api({ // const response = (await api({
// url: API_PATHS.filterListArtist, // url: API_PATHS.filterListArtist,
// method: 'GET', // method: 'GET',
// params: { // params: {
// unitName: fullNameKeyword.value, // businessName: businessName.value
// fieldName: fieldSelected.value, // taxCode: taxCode.value
// }, // ratings: ratings.value
// })) as AxiosResponse<BaseResponseBody<unknown>>; // },
// userTableRowsArtist.value = userTableRowsArtist.value.filter((item: unknown) => item.fullName = fullNameKeyword) // })) as AxiosResponse<BaseResponseBody<Artist[]>>;
// userTableRowsArtist.value = response.data.data
}; };
const changePageSize = () => { const changePageSize = () => {
pageIndex.value = 1; pageIndex.value = 1;
...@@ -214,42 +216,42 @@ export default defineComponent({ ...@@ -214,42 +216,42 @@ export default defineComponent({
}; };
const addNewCustomer = () => { const addNewCustomer = () => {
//gọi api thêm mới
try { try {
} catch (error) {}
} catch (error) {
}
}; };
const getDetailCustomer = (id: number) => {
const openUpdateCustomerDialog = () => { // gọi api chi tiết cần có id để lấy value cho từng customer
showDialogUpdate.value = true; // const response = (await api({
userName.value = ''; // url: ...,
customerName.value = ''; // method: 'GET',
businessName.value = ''; // params: {
taxCode.value = undefined; // id: id
email.value = ''; // }
ratings.value = undefined; // }))
address.value = ''; // 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...
businessType.value = undefined; // userName.value = response.data.data.userName
representative.value = ''; // Tương tự các biến còn lại
position.value = ''; };
phone.value = ''; const openUpdateCustomerDialog = (id: number) => {
showDialogUpdate.value = false;
console.log(id, 'iddd');
void getDetailCustomer(id);
}; };
const updateNewCustomer = () => { //Bấm nút lưu ở dialog update thì gọi api cập nhật trong hàm updateCustomer
const updateCustomer = () => {
//gọi api update
try { try {
} catch (error) {}
} catch (error) {
}
}; };
onMounted(() => { onMounted(() => {
void getListCustomer(); void getListCustomer();
}); });
return { return {
openUpdateCustomerDialog, openUpdateCustomerDialog,
updateNewCustomer, updateCustomer,
openAddCustomerDialog, openAddCustomerDialog,
addNewCustomer, addNewCustomer,
showDialogUpdate, showDialogUpdate,
...@@ -275,6 +277,7 @@ export default defineComponent({ ...@@ -275,6 +277,7 @@ export default defineComponent({
pageIndex, pageIndex,
pageSize, pageSize,
filterListCustomer, filterListCustomer,
// getDetailCustomer,
dataTest, dataTest,
totalPage, totalPage,
changePageSize, changePageSize,
......
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
separator="cell" separator="cell"
hide-pagination hide-pagination
> >
<template v-slot:body-cell-action=""> <template v-slot:body-cell-action="rowData">
<q-td style="padding: 0" class="flex flex-center"> <q-td style="padding: 0" class="flex flex-center">
<q-btn flat round color="primary" icon="mdi-information-outline"> <q-btn flat round color="primary" icon="mdi-information-outline">
<q-tooltip :offset="[20, 10]">{{ <q-tooltip :offset="[20, 10]">{{
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
round round
color="primary" color="primary"
icon="mdi-account-edit-outline" icon="mdi-account-edit-outline"
@click="openUpdateCustomerDialog()" @click="openUpdateCustomerDialog(rowData.row.id)"
> >
<q-tooltip :offset="[20, 10]">{{ <q-tooltip :offset="[20, 10]">{{
$t('customer.toolTipMessage.updateCustomerInfo') $t('customer.toolTipMessage.updateCustomerInfo')
...@@ -147,7 +147,7 @@ ...@@ -147,7 +147,7 @@
:ratings-options="ratingsOptions" :ratings-options="ratingsOptions"
:business-type-options="businessTypeOptions" :business-type-options="businessTypeOptions"
@click:CloseBtn="showDialogUpdate = false" @click:CloseBtn="showDialogUpdate = false"
@updateNewCustomer="updateNewCustomer" @updateNewCustomer="updateCustomer"
></UpdateNewCustomerDialogComponent> ></UpdateNewCustomerDialogComponent>
</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