Fix innerDocCard side one and two
This commit is contained in:
parent
a4e96cf809
commit
cba6774ec7
@ -15,20 +15,38 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-4">
|
<div class="mb-4">
|
||||||
<label for="document-file" class="block text-sm font-medium text-gray-700">Выберите файл</label>
|
<label class="block text-sm font-medium text-gray-700">
|
||||||
<input
|
Выберите файл
|
||||||
type="file"
|
</label>
|
||||||
id="document-file"
|
<FileUpload
|
||||||
@change="handleFileChange"
|
name="file"
|
||||||
class="w-full p-2 border rounded"
|
customUpload
|
||||||
|
:auto="false"
|
||||||
|
:multiple="false"
|
||||||
|
accept=".pdf,.doc,.docx,.jpg,.png"
|
||||||
|
@select="onFileSelect"
|
||||||
|
@uploader="saveDealDoc"
|
||||||
|
chooseLabel="Выбрать"
|
||||||
|
uploadLabel="Загрузить"
|
||||||
|
cancelLabel="Отмена"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="text-center">
|
<!-- <div class="mb-4">-->
|
||||||
<button @click="saveDealDoc" class="mt-4 p-2 rounded bg-blue-500 text-white">
|
<!-- <label for="document-file" class="block text-sm font-medium text-gray-700">Выберите файл</label>-->
|
||||||
Загрузить
|
<!-- <input-->
|
||||||
</button>
|
<!-- type="file"-->
|
||||||
</div>
|
<!-- id="document-file"-->
|
||||||
|
<!-- @change="handleFileChange"-->
|
||||||
|
<!-- class="w-full p-2 border rounded"-->
|
||||||
|
<!-- />-->
|
||||||
|
<!-- </div>-->
|
||||||
|
|
||||||
|
<!-- <div class="text-center">-->
|
||||||
|
<!-- <button @click="saveDealDoc" class="mt-4 p-2 rounded bg-blue-500 text-white">-->
|
||||||
|
<!-- Загрузить-->
|
||||||
|
<!-- </button>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -39,6 +57,7 @@ import {inject, ref} from 'vue';
|
|||||||
//import { useLaravelApi } from '@/composables/useLaravelApi';
|
//import { useLaravelApi } from '@/composables/useLaravelApi';
|
||||||
import { dealsApi } from '@/shared/api/deals';
|
import { dealsApi } from '@/shared/api/deals';
|
||||||
import InputText from "primevue/inputtext";
|
import InputText from "primevue/inputtext";
|
||||||
|
import FileUpload from 'primevue/fileupload';
|
||||||
|
|
||||||
// const props = defineProps({
|
// const props = defineProps({
|
||||||
// deal: {
|
// deal: {
|
||||||
@ -56,17 +75,25 @@ const props = dialogRef.value.data;
|
|||||||
const documentName = ref('');
|
const documentName = ref('');
|
||||||
const selectedFile = ref(null);
|
const selectedFile = ref(null);
|
||||||
|
|
||||||
// Обработчик изменения файла
|
// Событие выбора файла
|
||||||
const handleFileChange = (event) => {
|
const onFileSelect = (event) => {
|
||||||
selectedFile.value = event.target.files[0];
|
selectedFile.value = event.files[0];
|
||||||
|
console.log(selectedFile);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Обработчик изменения файла
|
||||||
|
// const handleFileChange = (event) => {
|
||||||
|
// selectedFile.value = event.target.files[0];
|
||||||
|
// };
|
||||||
|
|
||||||
const closeModal = () => {
|
const closeModal = () => {
|
||||||
//emit('close');
|
//emit('close');
|
||||||
};
|
};
|
||||||
|
|
||||||
// Сохранение документа
|
// Сохранение документа
|
||||||
const saveDealDoc = async () => {
|
const saveDealDoc = async (event) => {
|
||||||
|
console.log('saveDealDoc вызван', event);
|
||||||
if (!documentName.value || !selectedFile.value) {
|
if (!documentName.value || !selectedFile.value) {
|
||||||
alert('Пожалуйста, заполните все поля');
|
alert('Пожалуйста, заполните все поля');
|
||||||
return;
|
return;
|
||||||
@ -92,7 +119,6 @@ const saveDealDoc = async () => {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Ошибка при загрузке документа:', error);
|
console.error('Ошибка при загрузке документа:', error);
|
||||||
alert('Произошла ошибка при загрузке документа');
|
alert('Произошла ошибка при загрузке документа');
|
||||||
console.log('FormData entries:', [...formData.entries()]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// try {
|
// try {
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import DatePicker from 'primevue/datepicker'
|
|||||||
import InputNumber from 'primevue/inputnumber'
|
import InputNumber from 'primevue/inputnumber'
|
||||||
import Button from 'primevue/button'
|
import Button from 'primevue/button'
|
||||||
import MultiSelect from 'primevue/multiselect'
|
import MultiSelect from 'primevue/multiselect'
|
||||||
|
import FileUpload from 'primevue/fileupload';
|
||||||
|
|
||||||
import '@/assets/css/main.css'
|
import '@/assets/css/main.css'
|
||||||
|
|
||||||
@ -48,5 +49,6 @@ app.component('DatePicker', DatePicker)
|
|||||||
app.component('InputNumber', InputNumber)
|
app.component('InputNumber', InputNumber)
|
||||||
app.component('Button', Button)
|
app.component('Button', Button)
|
||||||
app.component('MultiSelect', MultiSelect)
|
app.component('MultiSelect', MultiSelect)
|
||||||
|
app.component('FileUpload', FileUpload)
|
||||||
|
|
||||||
app.mount('#app_deal')
|
app.mount('#app_deal')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user