feat: createProductService
This commit is contained in:
parent
566798e35a
commit
22f7329267
1 changed files with 50 additions and 6 deletions
|
|
@ -8,6 +8,21 @@ import DrawerInfo from 'src/components/DrawerInfo.vue';
|
||||||
import BasicInformation from 'src/components/04_product-service/BasicInformation.vue';
|
import BasicInformation from 'src/components/04_product-service/BasicInformation.vue';
|
||||||
import FormDialog from 'src/components/FormDialog.vue';
|
import FormDialog from 'src/components/FormDialog.vue';
|
||||||
import { dialog } from 'src/stores/utils';
|
import { dialog } from 'src/stores/utils';
|
||||||
|
|
||||||
|
import useProductServiceStore from 'src/stores/product-service';
|
||||||
|
import {
|
||||||
|
ProductGroup,
|
||||||
|
ProductGroupCreate,
|
||||||
|
} from 'src/stores/product-service/types';
|
||||||
|
|
||||||
|
const productServiceStore = useProductServiceStore();
|
||||||
|
|
||||||
|
const {
|
||||||
|
fetchStatsProductGroup,
|
||||||
|
fetchListProductService,
|
||||||
|
createProductService,
|
||||||
|
} = productServiceStore;
|
||||||
|
|
||||||
const cardData = ref({
|
const cardData = ref({
|
||||||
title: 'งาน MCU',
|
title: 'งาน MCU',
|
||||||
subtitle: 'G00000000001',
|
subtitle: 'G00000000001',
|
||||||
|
|
@ -37,6 +52,7 @@ const stat = ref<
|
||||||
]);
|
]);
|
||||||
|
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { onMounted } from 'vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
|
@ -47,16 +63,15 @@ const dialogInputForm = ref<boolean>(false);
|
||||||
const isType = ref<boolean>(false);
|
const isType = ref<boolean>(false);
|
||||||
const groupName = ref<string>('test');
|
const groupName = ref<string>('test');
|
||||||
|
|
||||||
const formData = ref({
|
const productGroup = ref<ProductGroup[]>();
|
||||||
|
|
||||||
|
const formData = ref<ProductGroupCreate>({
|
||||||
remark: '',
|
remark: '',
|
||||||
detail: '',
|
detail: '',
|
||||||
name: '',
|
name: '',
|
||||||
code: '',
|
code: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
async function submitGroup() {
|
|
||||||
console.log(formData.value);
|
|
||||||
}
|
|
||||||
async function submitType() {
|
async function submitType() {
|
||||||
console.log(formData.value);
|
console.log(formData.value);
|
||||||
}
|
}
|
||||||
|
|
@ -76,6 +91,36 @@ async function deleteProductById() {
|
||||||
cancel: () => {},
|
cancel: () => {},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function clearForm() {
|
||||||
|
formData.value = {
|
||||||
|
remark: '',
|
||||||
|
detail: '',
|
||||||
|
name: '',
|
||||||
|
code: '',
|
||||||
|
};
|
||||||
|
|
||||||
|
dialogInputForm.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function submitGroup() {
|
||||||
|
await createProductService(formData.value);
|
||||||
|
|
||||||
|
await fetchList();
|
||||||
|
clearForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchList() {
|
||||||
|
const res = await fetchListProductService();
|
||||||
|
|
||||||
|
if (res) {
|
||||||
|
productGroup.value = res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
await fetchList();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -211,7 +256,7 @@ async function deleteProductById() {
|
||||||
:title="$t('customerEmployerAdd')"
|
:title="$t('customerEmployerAdd')"
|
||||||
:submit="
|
:submit="
|
||||||
() => {
|
() => {
|
||||||
console.log('submit');
|
submitGroup();
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
:close="() => {}"
|
:close="() => {}"
|
||||||
|
|
@ -222,7 +267,6 @@ async function deleteProductById() {
|
||||||
:isType="isType"
|
:isType="isType"
|
||||||
v-model:remark="formData.remark"
|
v-model:remark="formData.remark"
|
||||||
v-model:name="formData.name"
|
v-model:name="formData.name"
|
||||||
v-model:code="formData.code"
|
|
||||||
v-model:detail="formData.detail"
|
v-model:detail="formData.detail"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue