update upload file check

This commit is contained in:
2021-08-13 10:18:36 +05:30
parent 670c7865ff
commit 799593f4af
14 changed files with 230 additions and 265 deletions

View File

@ -8,8 +8,8 @@
"main.css": "./static/css/main.12e98d00.chunk.css", "main.css": "./static/css/main.12e98d00.chunk.css",
"main.js": "./static/js/main.c02dc652.chunk.js", "main.js": "./static/js/main.c02dc652.chunk.js",
"main.js.map": "./static/js/main.c02dc652.chunk.js.map", "main.js.map": "./static/js/main.c02dc652.chunk.js.map",
"runtime-main.js": "./static/js/runtime-main.18ec15f6.js", "runtime-main.js": "./static/js/runtime-main.62598ad5.js",
"runtime-main.js.map": "./static/js/runtime-main.18ec15f6.js.map", "runtime-main.js.map": "./static/js/runtime-main.62598ad5.js.map",
"static/js/4.2aecef49.chunk.js": "./static/js/4.2aecef49.chunk.js", "static/js/4.2aecef49.chunk.js": "./static/js/4.2aecef49.chunk.js",
"static/js/4.2aecef49.chunk.js.map": "./static/js/4.2aecef49.chunk.js.map", "static/js/4.2aecef49.chunk.js.map": "./static/js/4.2aecef49.chunk.js.map",
"static/css/5.ecdd39c8.chunk.css": "./static/css/5.ecdd39c8.chunk.css", "static/css/5.ecdd39c8.chunk.css": "./static/css/5.ecdd39c8.chunk.css",
@ -17,10 +17,10 @@
"static/js/5.713b21d1.chunk.js.map": "./static/js/5.713b21d1.chunk.js.map", "static/js/5.713b21d1.chunk.js.map": "./static/js/5.713b21d1.chunk.js.map",
"static/js/6.bba51257.chunk.js": "./static/js/6.bba51257.chunk.js", "static/js/6.bba51257.chunk.js": "./static/js/6.bba51257.chunk.js",
"static/js/6.bba51257.chunk.js.map": "./static/js/6.bba51257.chunk.js.map", "static/js/6.bba51257.chunk.js.map": "./static/js/6.bba51257.chunk.js.map",
"static/js/7.24e41aee.chunk.js": "./static/js/7.24e41aee.chunk.js", "static/js/7.7a5be647.chunk.js": "./static/js/7.7a5be647.chunk.js",
"static/js/7.24e41aee.chunk.js.map": "./static/js/7.24e41aee.chunk.js.map", "static/js/7.7a5be647.chunk.js.map": "./static/js/7.7a5be647.chunk.js.map",
"static/js/8.40731ea8.chunk.js": "./static/js/8.40731ea8.chunk.js", "static/js/8.5b8eaf50.chunk.js": "./static/js/8.5b8eaf50.chunk.js",
"static/js/8.40731ea8.chunk.js.map": "./static/js/8.40731ea8.chunk.js.map", "static/js/8.5b8eaf50.chunk.js.map": "./static/js/8.5b8eaf50.chunk.js.map",
"static/js/9.311e2cfe.chunk.js": "./static/js/9.311e2cfe.chunk.js", "static/js/9.311e2cfe.chunk.js": "./static/js/9.311e2cfe.chunk.js",
"static/js/9.311e2cfe.chunk.js.map": "./static/js/9.311e2cfe.chunk.js.map", "static/js/9.311e2cfe.chunk.js.map": "./static/js/9.311e2cfe.chunk.js.map",
"static/js/10.1aee78b2.chunk.js": "./static/js/10.1aee78b2.chunk.js", "static/js/10.1aee78b2.chunk.js": "./static/js/10.1aee78b2.chunk.js",
@ -46,7 +46,7 @@
"static/js/6.bba51257.chunk.js.LICENSE.txt": "./static/js/6.bba51257.chunk.js.LICENSE.txt" "static/js/6.bba51257.chunk.js.LICENSE.txt": "./static/js/6.bba51257.chunk.js.LICENSE.txt"
}, },
"entrypoints": [ "entrypoints": [
"static/js/runtime-main.18ec15f6.js", "static/js/runtime-main.62598ad5.js",
"static/js/4.2aecef49.chunk.js", "static/js/4.2aecef49.chunk.js",
"static/css/main.12e98d00.chunk.css", "static/css/main.12e98d00.chunk.css",
"static/js/main.c02dc652.chunk.js" "static/js/main.c02dc652.chunk.js"

View File

@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="description" content="CoreUI for React - Open Source Bootstrap Admin Template"><meta name="author" content="Łukasz Holeczek"><meta name="keyword" content="Bootstrap,Admin,Template,Open,Source,CSS,SCSS,HTML,RWD,Dashboard,React"><title>FBS Admin tool</title><link rel="manifest" href="./manifest.json"><link rel="shortcut icon" href="./favicon.ico"><link href="./static/css/main.12e98d00.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function t(t){for(var n,o,u=t[0],i=t[1],f=t[2],d=0,s=[];d<u.length;d++)o=u[d],Object.prototype.hasOwnProperty.call(a,o)&&a[o]&&s.push(a[o][0]),a[o]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);for(l&&l(t);s.length;)s.shift()();return c.push.apply(c,f||[]),r()}function r(){for(var e,t=0;t<c.length;t++){for(var r=c[t],n=!0,o=1;o<r.length;o++){var i=r[o];0!==a[i]&&(n=!1)}n&&(c.splice(t--,1),e=u(u.s=r[0]))}return e}var n={},o={3:0},a={3:0},c=[];function u(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,u),r.l=!0,r.exports}u.e=function(e){var t=[];o[e]?t.push(o[e]):0!==o[e]&&{0:1,5:1}[e]&&t.push(o[e]=new Promise((function(t,r){for(var n="static/css/"+({}[e]||e)+"."+{0:"455ee148",1:"31d6cfe0",5:"ecdd39c8",6:"31d6cfe0",7:"31d6cfe0",8:"31d6cfe0",9:"31d6cfe0",10:"31d6cfe0",11:"31d6cfe0",12:"31d6cfe0",13:"31d6cfe0",14:"31d6cfe0",15:"31d6cfe0",16:"31d6cfe0"}[e]+".chunk.css",a=u.p+n,c=document.getElementsByTagName("link"),i=0;i<c.length;i++){var f=(l=c[i]).getAttribute("data-href")||l.getAttribute("href");if("stylesheet"===l.rel&&(f===n||f===a))return t()}var d=document.getElementsByTagName("style");for(i=0;i<d.length;i++){var l;if((f=(l=d[i]).getAttribute("data-href"))===n||f===a)return t()}var s=document.createElement("link");s.rel="stylesheet",s.type="text/css",s.onload=t,s.onerror=function(t){var n=t&&t.target&&t.target.src||a,c=new Error("Loading CSS chunk "+e+" failed.\n("+n+")");c.code="CSS_CHUNK_LOAD_FAILED",c.request=n,delete o[e],s.parentNode.removeChild(s),r(c)},s.href=a,document.getElementsByTagName("head")[0].appendChild(s)})).then((function(){o[e]=0})));var r=a[e];if(0!==r)if(r)t.push(r[2]);else{var n=new Promise((function(t,n){r=a[e]=[t,n]}));t.push(r[2]=n);var c,i=document.createElement("script");i.charset="utf-8",i.timeout=120,u.nc&&i.setAttribute("nonce",u.nc),i.src=function(e){return u.p+"static/js/"+({}[e]||e)+"."+{0:"e423db2b",1:"bd3709d0",5:"713b21d1",6:"bba51257",7:"24e41aee",8:"40731ea8",9:"311e2cfe",10:"1aee78b2",11:"d20ada69",12:"2c871bc8",13:"886a98ec",14:"ef6f2a9c",15:"e3d77fc1",16:"3fdf9cdf"}[e]+".chunk.js"}(e);var f=new Error;c=function(t){i.onerror=i.onload=null,clearTimeout(d);var r=a[e];if(0!==r){if(r){var n=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;f.message="Loading chunk "+e+" failed.\n("+n+": "+o+")",f.name="ChunkLoadError",f.type=n,f.request=o,r[1](f)}a[e]=void 0}};var d=setTimeout((function(){c({type:"timeout",target:i})}),12e4);i.onerror=i.onload=c,document.head.appendChild(i)}return Promise.all(t)},u.m=e,u.c=n,u.d=function(e,t,r){u.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},u.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.t=function(e,t){if(1&t&&(e=u(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(u.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)u.d(r,n,function(t){return e[t]}.bind(null,n));return r},u.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(t,"a",t),t},u.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},u.p="./",u.oe=function(e){throw console.error(e),e};var i=this["webpackJsonp@coreui/coreui-free-react-admin-template"]=this["webpackJsonp@coreui/coreui-free-react-admin-template"]||[],f=i.push.bind(i);i.push=t,i=i.slice();for(var d=0;d<i.length;d++)t(i[d]);var l=f;r()}([])</script><script src="./static/js/4.2aecef49.chunk.js"></script><script src="./static/js/main.c02dc652.chunk.js"></script></body></html> <!doctype html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="description" content="CoreUI for React - Open Source Bootstrap Admin Template"><meta name="author" content="Łukasz Holeczek"><meta name="keyword" content="Bootstrap,Admin,Template,Open,Source,CSS,SCSS,HTML,RWD,Dashboard,React"><title>FBS Admin tool</title><link rel="manifest" href="./manifest.json"><link rel="shortcut icon" href="./favicon.ico"><link href="./static/css/main.12e98d00.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function t(t){for(var n,o,u=t[0],i=t[1],f=t[2],d=0,s=[];d<u.length;d++)o=u[d],Object.prototype.hasOwnProperty.call(a,o)&&a[o]&&s.push(a[o][0]),a[o]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);for(l&&l(t);s.length;)s.shift()();return c.push.apply(c,f||[]),r()}function r(){for(var e,t=0;t<c.length;t++){for(var r=c[t],n=!0,o=1;o<r.length;o++){var i=r[o];0!==a[i]&&(n=!1)}n&&(c.splice(t--,1),e=u(u.s=r[0]))}return e}var n={},o={3:0},a={3:0},c=[];function u(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,u),r.l=!0,r.exports}u.e=function(e){var t=[];o[e]?t.push(o[e]):0!==o[e]&&{0:1,5:1}[e]&&t.push(o[e]=new Promise((function(t,r){for(var n="static/css/"+({}[e]||e)+"."+{0:"455ee148",1:"31d6cfe0",5:"ecdd39c8",6:"31d6cfe0",7:"31d6cfe0",8:"31d6cfe0",9:"31d6cfe0",10:"31d6cfe0",11:"31d6cfe0",12:"31d6cfe0",13:"31d6cfe0",14:"31d6cfe0",15:"31d6cfe0",16:"31d6cfe0"}[e]+".chunk.css",a=u.p+n,c=document.getElementsByTagName("link"),i=0;i<c.length;i++){var f=(l=c[i]).getAttribute("data-href")||l.getAttribute("href");if("stylesheet"===l.rel&&(f===n||f===a))return t()}var d=document.getElementsByTagName("style");for(i=0;i<d.length;i++){var l;if((f=(l=d[i]).getAttribute("data-href"))===n||f===a)return t()}var s=document.createElement("link");s.rel="stylesheet",s.type="text/css",s.onload=t,s.onerror=function(t){var n=t&&t.target&&t.target.src||a,c=new Error("Loading CSS chunk "+e+" failed.\n("+n+")");c.code="CSS_CHUNK_LOAD_FAILED",c.request=n,delete o[e],s.parentNode.removeChild(s),r(c)},s.href=a,document.getElementsByTagName("head")[0].appendChild(s)})).then((function(){o[e]=0})));var r=a[e];if(0!==r)if(r)t.push(r[2]);else{var n=new Promise((function(t,n){r=a[e]=[t,n]}));t.push(r[2]=n);var c,i=document.createElement("script");i.charset="utf-8",i.timeout=120,u.nc&&i.setAttribute("nonce",u.nc),i.src=function(e){return u.p+"static/js/"+({}[e]||e)+"."+{0:"e423db2b",1:"bd3709d0",5:"713b21d1",6:"bba51257",7:"7a5be647",8:"5b8eaf50",9:"311e2cfe",10:"1aee78b2",11:"d20ada69",12:"2c871bc8",13:"886a98ec",14:"ef6f2a9c",15:"e3d77fc1",16:"3fdf9cdf"}[e]+".chunk.js"}(e);var f=new Error;c=function(t){i.onerror=i.onload=null,clearTimeout(d);var r=a[e];if(0!==r){if(r){var n=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;f.message="Loading chunk "+e+" failed.\n("+n+": "+o+")",f.name="ChunkLoadError",f.type=n,f.request=o,r[1](f)}a[e]=void 0}};var d=setTimeout((function(){c({type:"timeout",target:i})}),12e4);i.onerror=i.onload=c,document.head.appendChild(i)}return Promise.all(t)},u.m=e,u.c=n,u.d=function(e,t,r){u.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},u.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.t=function(e,t){if(1&t&&(e=u(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(u.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)u.d(r,n,function(t){return e[t]}.bind(null,n));return r},u.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(t,"a",t),t},u.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},u.p="./",u.oe=function(e){throw console.error(e),e};var i=this["webpackJsonp@coreui/coreui-free-react-admin-template"]=this["webpackJsonp@coreui/coreui-free-react-admin-template"]||[],f=i.push.bind(i);i.push=t,i=i.slice();for(var d=0;d<i.length;d++)t(i[d]);var l=f;r()}([])</script><script src="./static/js/4.2aecef49.chunk.js"></script><script src="./static/js/main.c02dc652.chunk.js"></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,2 +0,0 @@
(this["webpackJsonp@coreui/coreui-free-react-admin-template"]=this["webpackJsonp@coreui/coreui-free-react-admin-template"]||[]).push([[8],{773:function(e,t,c){"use strict";c.r(t);var n=c(655),s=c(1),i=c(642),r=c.n(i),a=c(637),l=c(636),j=c(18);t.default=function(){var e=Object(s.useState)(null),t=Object(n.a)(e,2),c=t[0],i=t[1];return Object(j.jsx)("div",{children:Object(j.jsxs)(a.f,{children:[Object(j.jsx)(a.j,{children:"\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9 "})," ",Object(j.jsxs)(a.g,{children:[Object(j.jsxs)(a.t,{row:!0,children:[Object(j.jsxs)(a.k,{md:"3",children:[Object(j.jsx)(a.H,{htmlFor:"date-input",children:" \u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u3092\u9078\u3093\u3067\u304f\u3060\u3055\u3044 "})," "]})," ",Object(j.jsx)(a.k,{xs:"12",md:"9",children:Object(j.jsx)(a.C,{type:"file",onChange:function(e){i(e.target.files[0])},id:"file-input",name:"file-input"})})," "]}),Object(j.jsxs)(a.h,{children:[Object(j.jsxs)(a.e,{type:"submit",onClick:function(e){var t=new FormData;t.append("file",c),console.log("calling upload"),r.a.post("https://fsbsso.sumasen.net/upload",t,{}).then((function(e){"OK"==e.statusText&&alert("\u6b63\u5e38\u306b\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3055\u308c\u307e\u3057\u305f")}))},size:"sm",color:"primary",children:[" ",Object(j.jsx)(l.a,{name:"cil-scrubber"})," \u30a2\u30c3\u30d7\u30ed\u30fc\u30c9 "]})," "]})]})]})})}}}]);
//# sourceMappingURL=8.40731ea8.chunk.js.map

View File

@ -1 +0,0 @@
{"version":3,"sources":["views/Uploader/index.js"],"names":["Uploader","useState","file","setFile","row","md","htmlFor","xs","type","onChange","e","target","files","id","name","onClick","data","FormData","append","console","log","axios","post","then","res","statusText","alert","size","color"],"mappings":"mPA8EeA,UA7Df,WAEI,MAAwBC,mBAAS,MAAjC,mBAAOC,EAAP,KAAaC,EAAb,KAqBA,OAAS,8BAEL,eACA,IADA,WAEA,cACA,IADA,oDAFA,IAKc,eACd,IADc,WAEd,eACA,IADA,CACWC,KAAG,EADd,UAEA,eACA,IADA,CACKC,GAAK,IADV,UAEA,cACA,IADA,CACOC,QAAU,aADjB,wIAFA,OAFA,IAMO,cACP,IADO,CACFC,GAAK,KACVF,GAAK,IAFE,SAGP,cACA,IADA,CACWG,KAAO,OAClBC,SAvCJ,SAAyBC,GACrBP,EAAQO,EAAEC,OAAOC,MAAM,KAuCvBC,GAAK,aACLC,KAAO,iBAbP,OAiBA,eAAC,IAAD,WACA,eAAC,IAAD,CAASN,KAAO,SAChBO,QA3CJ,SAAwBL,GACpB,IAAMM,EAAO,IAAIC,SACjBD,EAAKE,OAAO,OAAQhB,GAEpBiB,QAAQC,IAAI,kBACZC,IAAMC,KAAK,oCAAqCN,EAAM,IAEjDO,MAAK,SAAAC,GAEoB,MAAlBA,EAAIC,YACNC,MAAM,4FAkChBC,KAAO,KACPC,MAAQ,UAHR,cAGoB,cAAE,IAAF,CAAQd,KAAO,iBAHnC,4CADA","file":"static/js/8.40731ea8.chunk.js","sourcesContent":["import React, { useState } from 'react';\nimport axios from 'axios';\nimport {\n CCol,\n CFormGroup,\n CInput,\n CInputFile,\n CLabel,\n CButton,\n CCard,\n CCardHeader,\n CCardBody,\n CCardFooter,\n} from '@coreui/react'\nimport CIcon from '@coreui/icons-react'\n\n\nfunction Uploader() {\n\n const [file, setFile] = useState(null);\n\n function onChangeHandler(e) {\n setFile(e.target.files[0])\n }\n\n function onClickHandler(e) {\n const data = new FormData()\n data.append('file', file);\n //console.log(file);\n console.log('calling upload');\n axios.post(\"https://fsbsso.sumasen.net/upload\", data, { // receive two parameter endpoint url ,form data\n })\n .then(res => { // then print response status\n //console.log(res.statusText)\n if (res.statusText == 'OK') {\n alert(\"正常にアップロードされました\");\n }\n });\n }\n\n return ( <\n div >\n <\n CCard >\n <\n CCardHeader >\n アップロード <\n /CCardHeader> <\n CCardBody >\n <\n CFormGroup row >\n <\n CCol md = \"3\" >\n <\n CLabel htmlFor = \"date-input\" > アップロードするファイルを選んでください < /CLabel> < /\n CCol > <\n CCol xs = \"12\"\n md = \"9\" >\n <\n CInputFile type = \"file\"\n onChange = { onChangeHandler }\n id = \"file-input\"\n name = \"file-input\" / >\n <\n /CCol> < /\n CFormGroup >\n <CCardFooter >\n <CButton type = \"submit\"\n onClick = { onClickHandler }\n size = \"sm\"\n color = \"primary\" > < CIcon name = \"cil-scrubber\" / > アップロード < /CButton> < /\n CCardFooter>\n </CCardBody>\n </CCard>\n </div>\n )\n}\n\nexport default Uploader\n"],"sourceRoot":""}

View File

@ -0,0 +1,2 @@
(this["webpackJsonp@coreui/coreui-free-react-admin-template"]=this["webpackJsonp@coreui/coreui-free-react-admin-template"]||[]).push([[8],{773:function(e,t,i){"use strict";i.r(t);var n=i(655),s=i(1),c=i(642),r=i.n(c),a=i(637),l=i(636),j=i(18);t.default=function(){var e=Object(s.useState)(null),t=Object(n.a)(e,2),i=t[0],c=t[1];return Object(j.jsx)("div",{children:Object(j.jsxs)(a.f,{children:[Object(j.jsx)(a.j,{children:"\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9 "})," ",Object(j.jsxs)(a.g,{children:[Object(j.jsxs)(a.t,{row:!0,children:[Object(j.jsxs)(a.k,{md:"3",children:[Object(j.jsx)(a.H,{htmlFor:"date-input",children:" \u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u3092\u9078\u3093\u3067\u304f\u3060\u3055\u3044 "})," "]})," ",Object(j.jsx)(a.k,{xs:"12",md:"9",children:Object(j.jsx)(a.C,{type:"file",onChange:function(e){c(e.target.files[0])},id:"file-input",name:"file-input"})})," "]}),Object(j.jsxs)(a.h,{children:[Object(j.jsxs)(a.e,{type:"submit",onClick:function(e){var t=new FormData;t.append("file",i),"ini_\u5de5\u7a0b\u5185\u691c\u67fb\u7968.xlsx"===i.name||"ini_\u30c7\u30fc\u30bf\u5165\u529b\u30b7\u30fc\u30c8.xlsx"===i.name?r.a.post("https://fsbsso.sumasen.net/upload",t,{}).then((function(e){"OK"==e.statusText&&alert("\u6b63\u5e38\u306b\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3055\u308c\u307e\u3057\u305f")})):alert("\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9"+i.name+"\u9593\u9055\u3063\u3066\u3044\u308b\u3002\u540d\u524d\u3092\u5909\u66f4\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059 ini_\u5de5\u7a0b\u5185\u691c\u67fb\u7968.xlsx \u307e\u305f ini_\u30c7\u30fc\u30bf\u5165\u529b\u30b7\u30fc\u30c8.xlsx")},size:"sm",color:"primary",children:[" ",Object(j.jsx)(l.a,{name:"cil-scrubber"})," \u30a2\u30c3\u30d7\u30ed\u30fc\u30c9 "]})," "]})]})]})})}}}]);
//# sourceMappingURL=8.5b8eaf50.chunk.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["views/Uploader/index.js"],"names":["Uploader","useState","file","setFile","row","md","htmlFor","xs","type","onChange","e","target","files","id","name","onClick","data","FormData","append","axios","post","then","res","statusText","alert","size","color"],"mappings":"mPAsFeA,UArEf,WAEI,MAAwBC,mBAAS,MAAjC,mBAAOC,EAAP,KAAaC,EAAb,KA6BA,OAAS,8BAEL,eACA,IADA,WAEA,cACA,IADA,oDAFA,IAKc,eACd,IADc,WAEd,eACA,IADA,CACWC,KAAG,EADd,UAEA,eACA,IADA,CACKC,GAAK,IADV,UAEA,cACA,IADA,CACOC,QAAU,aADjB,wIAFA,OAFA,IAMO,cACP,IADO,CACFC,GAAK,KACVF,GAAK,IAFE,SAGP,cACA,IADA,CACWG,KAAO,OAClBC,SA/CJ,SAAyBC,GACrBP,EAAQO,EAAEC,OAAOC,MAAM,KA+CvBC,GAAK,aACLC,KAAO,iBAbP,OAiBA,eAAC,IAAD,WACA,eAAC,IAAD,CAASN,KAAO,SAChBO,QAnDJ,SAAwBL,GACpB,IAAMM,EAAO,IAAIC,SACjBD,EAAKE,OAAO,OAAQhB,GACH,kDAAdA,EAAKY,MAA4C,8DAAdZ,EAAKY,KAEzCK,IAAMC,KAAK,oCAAqCJ,EAAM,IAEnDK,MAAK,SAAAC,GAEoB,MAAlBA,EAAIC,YACNC,MAAM,2FAKdA,MAAM,2EAAiBtB,EAAKY,KAAO,wPAqCrCW,KAAO,KACPC,MAAQ,UAHR,cAGoB,cAAE,IAAF,CAAQZ,KAAO,iBAHnC,4CADA","file":"static/js/8.5b8eaf50.chunk.js","sourcesContent":["import React, { useState } from 'react';\nimport axios from 'axios';\nimport {\n CCol,\n CFormGroup,\n CInput,\n CInputFile,\n CLabel,\n CButton,\n CCard,\n CCardHeader,\n CCardBody,\n CCardFooter,\n} from '@coreui/react'\nimport CIcon from '@coreui/icons-react'\n\n\nfunction Uploader() {\n\n const [file, setFile] = useState(null);\n\n function onChangeHandler(e) {\n setFile(e.target.files[0])\n }\n\n function onClickHandler(e) {\n const data = new FormData()\n data.append('file', file);\n if(file.name === 'ini_工程内検査票.xlsx' || file.name === 'ini_データ入力シート.xlsx')\n {\n axios.post(\"https://fsbsso.sumasen.net/upload\", data, { // receive two parameter endpoint url ,form data\n })\n .then(res => { // then print response status\n //console.log(res.statusText)\n if (res.statusText == 'OK') {\n alert(\"正常にアップロードされました\");\n }\n });\n }\n else {\n alert(\"ファイル名をアップロード\" + file.name + \"間違っている。名前を変更する必要があります ini_工程内検査票.xlsx また ini_データ入力シート.xlsx\");\n return\n }\n //console.log(file.name);\n //console.log('calling upload');\n\n }\n\n return ( <\n div >\n <\n CCard >\n <\n CCardHeader >\n アップロード <\n /CCardHeader> <\n CCardBody >\n <\n CFormGroup row >\n <\n CCol md = \"3\" >\n <\n CLabel htmlFor = \"date-input\" > アップロードするファイルを選んでください < /CLabel> < /\n CCol > <\n CCol xs = \"12\"\n md = \"9\" >\n <\n CInputFile type = \"file\"\n onChange = { onChangeHandler }\n id = \"file-input\"\n name = \"file-input\" / >\n <\n /CCol> < /\n CFormGroup >\n <CCardFooter >\n <CButton type = \"submit\"\n onClick = { onClickHandler }\n size = \"sm\"\n color = \"primary\" > < CIcon name = \"cil-scrubber\" / > アップロード < /CButton> < /\n CCardFooter>\n </CCardBody>\n </CCard>\n </div>\n )\n}\n\nexport default Uploader\n"],"sourceRoot":""}

View File

@ -1,2 +1,2 @@
!function(e){function t(t){for(var n,o,u=t[0],i=t[1],f=t[2],d=0,s=[];d<u.length;d++)o=u[d],Object.prototype.hasOwnProperty.call(a,o)&&a[o]&&s.push(a[o][0]),a[o]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);for(l&&l(t);s.length;)s.shift()();return c.push.apply(c,f||[]),r()}function r(){for(var e,t=0;t<c.length;t++){for(var r=c[t],n=!0,o=1;o<r.length;o++){var i=r[o];0!==a[i]&&(n=!1)}n&&(c.splice(t--,1),e=u(u.s=r[0]))}return e}var n={},o={3:0},a={3:0},c=[];function u(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,u),r.l=!0,r.exports}u.e=function(e){var t=[];o[e]?t.push(o[e]):0!==o[e]&&{0:1,5:1}[e]&&t.push(o[e]=new Promise((function(t,r){for(var n="static/css/"+({}[e]||e)+"."+{0:"455ee148",1:"31d6cfe0",5:"ecdd39c8",6:"31d6cfe0",7:"31d6cfe0",8:"31d6cfe0",9:"31d6cfe0",10:"31d6cfe0",11:"31d6cfe0",12:"31d6cfe0",13:"31d6cfe0",14:"31d6cfe0",15:"31d6cfe0",16:"31d6cfe0"}[e]+".chunk.css",a=u.p+n,c=document.getElementsByTagName("link"),i=0;i<c.length;i++){var f=(l=c[i]).getAttribute("data-href")||l.getAttribute("href");if("stylesheet"===l.rel&&(f===n||f===a))return t()}var d=document.getElementsByTagName("style");for(i=0;i<d.length;i++){var l;if((f=(l=d[i]).getAttribute("data-href"))===n||f===a)return t()}var s=document.createElement("link");s.rel="stylesheet",s.type="text/css",s.onload=t,s.onerror=function(t){var n=t&&t.target&&t.target.src||a,c=new Error("Loading CSS chunk "+e+" failed.\n("+n+")");c.code="CSS_CHUNK_LOAD_FAILED",c.request=n,delete o[e],s.parentNode.removeChild(s),r(c)},s.href=a,document.getElementsByTagName("head")[0].appendChild(s)})).then((function(){o[e]=0})));var r=a[e];if(0!==r)if(r)t.push(r[2]);else{var n=new Promise((function(t,n){r=a[e]=[t,n]}));t.push(r[2]=n);var c,i=document.createElement("script");i.charset="utf-8",i.timeout=120,u.nc&&i.setAttribute("nonce",u.nc),i.src=function(e){return u.p+"static/js/"+({}[e]||e)+"."+{0:"e423db2b",1:"bd3709d0",5:"713b21d1",6:"bba51257",7:"24e41aee",8:"40731ea8",9:"311e2cfe",10:"1aee78b2",11:"d20ada69",12:"2c871bc8",13:"886a98ec",14:"ef6f2a9c",15:"e3d77fc1",16:"3fdf9cdf"}[e]+".chunk.js"}(e);var f=new Error;c=function(t){i.onerror=i.onload=null,clearTimeout(d);var r=a[e];if(0!==r){if(r){var n=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;f.message="Loading chunk "+e+" failed.\n("+n+": "+o+")",f.name="ChunkLoadError",f.type=n,f.request=o,r[1](f)}a[e]=void 0}};var d=setTimeout((function(){c({type:"timeout",target:i})}),12e4);i.onerror=i.onload=c,document.head.appendChild(i)}return Promise.all(t)},u.m=e,u.c=n,u.d=function(e,t,r){u.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},u.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.t=function(e,t){if(1&t&&(e=u(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(u.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)u.d(r,n,function(t){return e[t]}.bind(null,n));return r},u.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(t,"a",t),t},u.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},u.p="./",u.oe=function(e){throw console.error(e),e};var i=this["webpackJsonp@coreui/coreui-free-react-admin-template"]=this["webpackJsonp@coreui/coreui-free-react-admin-template"]||[],f=i.push.bind(i);i.push=t,i=i.slice();for(var d=0;d<i.length;d++)t(i[d]);var l=f;r()}([]); !function(e){function t(t){for(var n,o,u=t[0],i=t[1],f=t[2],d=0,s=[];d<u.length;d++)o=u[d],Object.prototype.hasOwnProperty.call(a,o)&&a[o]&&s.push(a[o][0]),a[o]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);for(l&&l(t);s.length;)s.shift()();return c.push.apply(c,f||[]),r()}function r(){for(var e,t=0;t<c.length;t++){for(var r=c[t],n=!0,o=1;o<r.length;o++){var i=r[o];0!==a[i]&&(n=!1)}n&&(c.splice(t--,1),e=u(u.s=r[0]))}return e}var n={},o={3:0},a={3:0},c=[];function u(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,u),r.l=!0,r.exports}u.e=function(e){var t=[];o[e]?t.push(o[e]):0!==o[e]&&{0:1,5:1}[e]&&t.push(o[e]=new Promise((function(t,r){for(var n="static/css/"+({}[e]||e)+"."+{0:"455ee148",1:"31d6cfe0",5:"ecdd39c8",6:"31d6cfe0",7:"31d6cfe0",8:"31d6cfe0",9:"31d6cfe0",10:"31d6cfe0",11:"31d6cfe0",12:"31d6cfe0",13:"31d6cfe0",14:"31d6cfe0",15:"31d6cfe0",16:"31d6cfe0"}[e]+".chunk.css",a=u.p+n,c=document.getElementsByTagName("link"),i=0;i<c.length;i++){var f=(l=c[i]).getAttribute("data-href")||l.getAttribute("href");if("stylesheet"===l.rel&&(f===n||f===a))return t()}var d=document.getElementsByTagName("style");for(i=0;i<d.length;i++){var l;if((f=(l=d[i]).getAttribute("data-href"))===n||f===a)return t()}var s=document.createElement("link");s.rel="stylesheet",s.type="text/css",s.onload=t,s.onerror=function(t){var n=t&&t.target&&t.target.src||a,c=new Error("Loading CSS chunk "+e+" failed.\n("+n+")");c.code="CSS_CHUNK_LOAD_FAILED",c.request=n,delete o[e],s.parentNode.removeChild(s),r(c)},s.href=a,document.getElementsByTagName("head")[0].appendChild(s)})).then((function(){o[e]=0})));var r=a[e];if(0!==r)if(r)t.push(r[2]);else{var n=new Promise((function(t,n){r=a[e]=[t,n]}));t.push(r[2]=n);var c,i=document.createElement("script");i.charset="utf-8",i.timeout=120,u.nc&&i.setAttribute("nonce",u.nc),i.src=function(e){return u.p+"static/js/"+({}[e]||e)+"."+{0:"e423db2b",1:"bd3709d0",5:"713b21d1",6:"bba51257",7:"7a5be647",8:"5b8eaf50",9:"311e2cfe",10:"1aee78b2",11:"d20ada69",12:"2c871bc8",13:"886a98ec",14:"ef6f2a9c",15:"e3d77fc1",16:"3fdf9cdf"}[e]+".chunk.js"}(e);var f=new Error;c=function(t){i.onerror=i.onload=null,clearTimeout(d);var r=a[e];if(0!==r){if(r){var n=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;f.message="Loading chunk "+e+" failed.\n("+n+": "+o+")",f.name="ChunkLoadError",f.type=n,f.request=o,r[1](f)}a[e]=void 0}};var d=setTimeout((function(){c({type:"timeout",target:i})}),12e4);i.onerror=i.onload=c,document.head.appendChild(i)}return Promise.all(t)},u.m=e,u.c=n,u.d=function(e,t,r){u.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},u.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.t=function(e,t){if(1&t&&(e=u(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(u.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)u.d(r,n,function(t){return e[t]}.bind(null,n));return r},u.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(t,"a",t),t},u.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},u.p="./",u.oe=function(e){throw console.error(e),e};var i=this["webpackJsonp@coreui/coreui-free-react-admin-template"]=this["webpackJsonp@coreui/coreui-free-react-admin-template"]||[],f=i.push.bind(i);i.push=t,i=i.slice();for(var d=0;d<i.length;d++)t(i[d]);var l=f;r()}([]);
//# sourceMappingURL=runtime-main.18ec15f6.js.map //# sourceMappingURL=runtime-main.62598ad5.js.map

View File

@ -56,7 +56,7 @@ function Index() {
useEffect(() => { useEffect(() => {
async function fetchData() { async function fetchData() {
// You can await here // You can await here
if (selectedcons !== "" && report !== "") { if(selectedcons !== "" && report !== "") {
const result = await axios('https://natnats.mobilous.com/getDateToHaveData?construction_id=' + selectedcons + '&sheetname=' + report); const result = await axios('https://natnats.mobilous.com/getDateToHaveData?construction_id=' + selectedcons + '&sheetname=' + report);
setValidDates(result.data.record); setValidDates(result.data.record);
} }
@ -74,7 +74,7 @@ function Index() {
return thisDate; return thisDate;
} }
function setingReport(e) { function setingReport(e){
setReport(e.target.value); setReport(e.target.value);
setStartDate(null); setStartDate(null);
} }
@ -84,20 +84,21 @@ function Index() {
setStartDate(null); setStartDate(null);
} }
function setingGraph(e) { function setingGraph(e){
setGraph(e.target.checked); setGraph(e.target.checked);
} }
function doGetReport() { function doGetReport(){
if (report == "" || selectedcons == "") { if(report == "" || selectedcons == ""){
alert("建設とレポートの両方を選択してください"); alert("建設とレポートの両方を選択してください");
return; return;
} }
var url = ""; var url = "";
if (graph) { if(graph){
url = baseUrl + "/generate" + report + "?construction_id=" + selectedcons + "&construction_date=" + getDateWithFormat(startDate) + "&graph=true"; url = baseUrl + "/generate" + report + "?construction_id=" +selectedcons+ "&construction_date="+getDateWithFormat(startDate)+"&graph=true";
} else { }
url = baseUrl + "/generate" + report + "?construction_id=" + selectedcons + "&construction_date=" + getDateWithFormat(startDate); else{
url = baseUrl + "/generate" + report + "?construction_id=" +selectedcons+ "&construction_date="+getDateWithFormat(startDate);
} }
downloadReport(url); downloadReport(url);
} }
@ -120,143 +121,99 @@ function Index() {
const checkAvilable = (date) => { const checkAvilable = (date) => {
var thisDate = getDateWithFormat(date); var thisDate = getDateWithFormat(date);
if (validDates.includes(thisDate)) { if(validDates.includes(thisDate)){
return true; return true;
} else { }
else{
return false; return false;
} }
}; };
return ( < return (
CRow > <CRow>
< <CCol xs="12" sm="12" md="12">
CCol xs = "12" <CCard>
sm = "12" <CCardHeader>
md = "12" > レポート
< </CCardHeader>
CCard > <CCardBody>
<
CCardHeader >
レポート <
/CCardHeader> <
CCardBody >
< <CSelect custom name="cons_select" id="cons_select" onChange={setingSelectedCons}>
CSelect custom name = "cons_select" " <option value=''>-- 工事名 --</option>"+
id = "cons_select" {
onChange = { setingSelectedCons } >
" <option value=''>-- レポート種類 --</option>" + {
data.map((cc, index) => { data.map((cc, index) => {
return ( < return(
option key = { cc.construction_id } <option key={cc.construction_id} value={cc.construction_id}>{cc.construction_name}</option>
value = { cc.construction_id } > { cc.construction_name } < /option>
) )
}) })
} <
/CSelect>
<
CCard >
<
CCardBody >
<
CForm action = ""
method = "post"
encType = "multipart/form-data"
className = "form-horizontal" >
<
CFormGroup row >
<
CCol md = "3" >
<
CLabel htmlFor = "select" > レポート種類 < /CLabel> <
/CCol> <
CCol xs = "12"
md = "9" >
<
CSelect custom name = "select"
id = "select"
onChange = { setingReport }
value = { report } >
<
option value = "" > --レポート種類-- < /option> <
option value = "BoxDisplacement" > 函体変位表 < /option> <
option value = "MachineControl" > オープンシールドマシン管理日報 < /option> <
option value = "MachineSheet" > オープンシールド機変位表 < /option> <
option value = "Measurement" > 函底高 偏位量測定一覧表 < /option> <
option value = "CheckSheet" > 工程内検査表 < /option> <
option value = "Injection" > 裏込注入材料受払い簿 < /option> <
/CSelect> <
/CCol> <
/CFormGroup> <
CFormGroup row >
<
CCol md = "3" >
<
CLabel htmlFor = "select" > 報告日 < /CLabel> <
/CCol> <
CCol xs = "12"
md = "9" >
<
DatePicker dateFormat = "yyyy/MM/dd"
selected = { startDate }
onChange = {
(date) => setStartDate(date) }
filterDate = { checkAvilable }
placeholderText = '日付を選択' /
>
<
/CCol> <
/CFormGroup>
{
report == 'MachineControl' ?
<
CFormGroup variant = "checkbox"
className = "checkbox" >
<
CInputCheckbox
id = "checkbox1"
name = "checkbox1"
checked = { graph }
value = 'graph'
onChange = { setingGraph }
/> <
CLabel variant = "checkbox"
className = "form-check-label"
htmlFor = "checkbox1" > グラフの有無 < /CLabel> <
/CFormGroup>:
("")
} }
</CSelect>
< <CCard>
/CForm> < <CCardBody>
/CCardBody> < <CForm action="" method="post" encType="multipart/form-data" className="form-horizontal">
CCardFooter > { <CFormGroup row>
startDate != null ? <CCol md="3">
< <CLabel htmlFor="select">レポート種類</CLabel>
CButton type = "submit" </CCol>
size = "sm" <CCol xs="12" md="9">
color = "primary" <CSelect custom name="select" id="select" onChange={setingReport} value={report}>
onClick = { doGetReport } > < CIcon name = "cil-scrubber" / > ダウンロード < /CButton> : <option value="">-- レポート種類 --</option>
< <option value="BoxDisplacement">函体変位表</option>
CButton disabled type = "submit" <option value="MachineControl">オープンシールドマシン管理日報</option>
size = "sm" <option value="MachineSheet">オープンシールド機変位表</option>
color = "primary" <option value="Measurement">函底高偏位量測定一覧表</option>
onClick = { doGetReport } > < CIcon name = "cil-scrubber" / > ダウンロード < /CButton> <option value="CheckSheet">工程内検査表</option>
} < <option value="Injection">裏込注入材料受払い簿</option>
/CCardFooter> < </CSelect>
/CCard> < </CCol>
/CCardBody> < </CFormGroup>
/CCard> < <CFormGroup row>
/CCol> < <CCol md="3">
CCol xs = "1" <CLabel htmlFor="select">報告日</CLabel>
sm = "1" </CCol>
md = "1" > <CCol xs="12" md="9">
< <DatePicker
/CCol> < dateFormat="yyyy/MM/dd"
/CRow> selected={startDate}
onChange={(date) => setStartDate(date)}
filterDate={checkAvilable}
placeholderText='日付を選択'
/>
</CCol>
</CFormGroup>
{report == 'MachineControl' ?
<CFormGroup variant="checkbox" className="checkbox">
<CInputCheckbox
id="checkbox1"
name="checkbox1"
checked = {graph}
value='graph'
onChange={setingGraph}
/>
<CLabel variant="checkbox" className="form-check-label" htmlFor="checkbox1">グラフの有無</CLabel>
</CFormGroup>
:
("")}
</CForm>
</CCardBody>
<CCardFooter>
{startDate != null ?
<CButton type="submit" size="sm" color="primary" onClick={doGetReport}><CIcon name="cil-scrubber" /> ダウンロード</CButton>
:
<CButton disabled type="submit" size="sm" color="primary" onClick={doGetReport}><CIcon name="cil-scrubber" /> ダウンロード</CButton>
}
</CCardFooter>
</CCard>
</CCardBody>
</CCard>
</CCol>
<CCol xs="1" sm="1" md="1">
</CCol>
</CRow>
); );
} }

View File

@ -26,8 +26,8 @@ function Uploader() {
function onClickHandler(e) { function onClickHandler(e) {
const data = new FormData() const data = new FormData()
data.append('file', file); data.append('file', file);
//console.log(file); if(file.name === 'ini_工程内検査票.xlsx' || file.name === 'ini_データ入力シート.xlsx')
console.log('calling upload'); {
axios.post("https://fsbsso.sumasen.net/upload", data, { // receive two parameter endpoint url ,form data axios.post("https://fsbsso.sumasen.net/upload", data, { // receive two parameter endpoint url ,form data
}) })
.then(res => { // then print response status .then(res => { // then print response status
@ -37,6 +37,14 @@ function Uploader() {
} }
}); });
} }
else {
alert("ファイル名をアップロード" + file.name + "間違っている。名前を変更する必要があります ini_工程内検査票.xlsx また ini_データ入力シート.xlsx");
return
}
//console.log(file.name);
//console.log('calling upload');
}
return ( < return ( <
div > div >