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