Merge branch 'master' of https://dev.azure.com/alicorn-dev/KintoneAppBuilder/_git/KintoneAppBuilder
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
<template>
|
||||
<div class="q-pa-md">
|
||||
<q-uploader
|
||||
v-on:finish="uploadFinished"
|
||||
:on-finish="uploadFinished"
|
||||
style="max-width: 400px"
|
||||
:url="uploadUrl"
|
||||
:label="title"
|
||||
accept=".csv,.xlsx"
|
||||
v-on:rejected="onRejected"
|
||||
:on-rejected="onRejected"
|
||||
field-name="file"
|
||||
></q-uploader>
|
||||
</div>
|
||||
@@ -17,20 +17,11 @@
|
||||
|
||||
|
||||
const $q=useQuasar();
|
||||
// const allowTypes=['.xlsx','.csv'];
|
||||
|
||||
// function checkFileType(files : File[] ):File[]{
|
||||
// return files.filter((file)=>{
|
||||
// let filename = file.name.toLowerCase();
|
||||
// for(let ext of allowTypes){
|
||||
// if(filename.endsWith(ext)){
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
// });
|
||||
// }
|
||||
|
||||
/**
|
||||
* ファイルアップロードを拒否する時の処理
|
||||
* @param rejectedEntries
|
||||
*/
|
||||
function onRejected (rejectedEntries:any) {
|
||||
// Notify plugin needs to be installed
|
||||
// https://quasar.dev/quasar-plugins/notify#Installation
|
||||
@@ -38,17 +29,37 @@
|
||||
type: 'negative',
|
||||
message: `CSVおよびExcelファイルを選択してください。`
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
function uploadFinished(){
|
||||
/**
|
||||
* ファイルアップロード成功時の処理
|
||||
*/
|
||||
function onUploadFinished({xhr}:{xhr:XMLHttpRequest}){
|
||||
let msg="ファイルのアップロードが完了しました。";
|
||||
if(xhr && xhr.response){
|
||||
msg=`${msg} (${xhr.responseText})`;
|
||||
}
|
||||
$q.notify({
|
||||
type: 'info',
|
||||
message: 'ファイルの読込が完了しました。'
|
||||
})
|
||||
type: 'positive',
|
||||
caption:"通知",
|
||||
message: msg
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param info ファイルアップロード失敗時の処理
|
||||
*/
|
||||
function onFailed({files,xhr}:{files: readonly any[],xhr:any}){
|
||||
let msg ="ファイルアップロードが失敗しました。";
|
||||
if(xhr && xhr.status){
|
||||
msg=`${msg} (${xhr.status }:${xhr.statusText})`
|
||||
}
|
||||
$q.notify({
|
||||
type:"negative",
|
||||
message:msg
|
||||
});
|
||||
}
|
||||
interface Props {
|
||||
title: string;
|
||||
uploadUrl:string;
|
||||
|
||||
Reference in New Issue
Block a user