You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

MinioUploader.vue 21 kB

4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
4 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
4 years ago
4 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
3 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  1. <template>
  2. <div class="dropzone-wrapper dataset-files">
  3. <div id="dataset" class="dropzone">
  4. <div class="maxfilesize ui red message" style="display: none;margin: 2.5rem;"></div>
  5. </div>
  6. <el-button style="background-color: #21ba45;margin-top: 2rem;" type="success" :disabled="btnFlag" @click="startUpload">{{upload}}</el-button>
  7. <el-button type="info" @click="cancelDataset">{{cancel}}</el-button>
  8. <div style="margin-top: 2rem;position: relative;">
  9. <label class="el-form-item__label" style="width: 140px;position: absolute;left: -140px;">上传状态:</label>
  10. <div v-for="item in allUploadFiles" style="display:flex;padding: 0.8rem 0;border-bottom: 1px solid #e8e8e8;line-height: 1;" >
  11. <span style="flex:4 1 0%;display: flex;max-width: 80%;"><i :class="[item.status===0?'ri-checkbox-circle-line success':'ri-close-circle-line failed']" style="margin-right: 0.5rem;"></i><span class="nowrap">{{item.name}}</span></span>
  12. <span style="flex:1" v-if="item.status===0"><span style="color: #21ba45;">上传成功</span></span>
  13. <span style="flex:1" v-else-if="item.status===1">
  14. <el-tooltip class="item" effect="dark" placement="top">
  15. <div slot="content">{{item.info}}</div>
  16. <span style="color: red;cursor: pointer;">上传失败<span>(重复上传)</span></span>
  17. </el-tooltip>
  18. </span>
  19. <span style="flex:1" v-else><span style="color: red;">上传失败</span></span>
  20. </div>
  21. </div>
  22. </div>
  23. </template>
  24. <script>
  25. import SparkMD5 from 'spark-md5';
  26. import axios from 'axios';
  27. import qs from 'qs';
  28. import createDropzone from '../features/dropzone.js';
  29. const {_AppSubUrl, _StaticUrlPrefix, csrf} = window.config;
  30. const chunkSize = 1024 * 1024 * 64;
  31. const md5ChunkSize = 1024 * 1024 * 1;
  32. export default {
  33. props:{
  34. uploadtype:{
  35. type:Number,
  36. required:true
  37. },
  38. desc:{
  39. type:String,
  40. default:''
  41. }
  42. },
  43. data() {
  44. return {
  45. dropzoneUploader: null,
  46. maxFiles: 10,
  47. maxFilesize: 200 ,
  48. acceptedFiles: '*/*',
  49. progress: 0,
  50. status: '',
  51. dropzoneParams: {},
  52. file_status_text: '',
  53. file:{},
  54. repoPath:'',
  55. btnFlag:false,
  56. cancel:'',
  57. upload:'',
  58. uploadFiles:[],
  59. uploadFilesAddId:[],
  60. allUploadFiles:[],
  61. uploadLength:0,
  62. allUploadLength:0,
  63. };
  64. },
  65. async mounted() {
  66. this.dropzoneParams = $('div#minioUploader-params');
  67. this.file_status_text = this.dropzoneParams.data('file-status');
  68. this.status = this.dropzoneParams.data('file-init-status');
  69. this.repoPath = this.dropzoneParams.data('repopath');
  70. this.cancel = this.dropzoneParams.data('cancel');
  71. this.upload = this.dropzoneParams.data('upload');
  72. let previewTemplate = `
  73. <div class="dz-preview dz-file-preview">
  74. <div class="dz-image">
  75. <img data-dz-thumbnail />
  76. </div>
  77. <div class="dz-details">
  78. <div class="dz-size"><span data-dz-size></span></div>
  79. <div class="dz-filename"><span data-dz-name></span></div>
  80. </div>
  81. <div class="dz-progress"><span class="dz-upload" data-dz-uploadprogress></span></div>
  82. <div class="dz-error-message" style="line-height: 1.5;"><span data-dz-errormessage></span></div>
  83. <div class="dz-success-mark"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="54" height="54"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm0-2a8 8 0 1 0 0-16 8 8 0 0 0 0 16zm-.997-4L6.76 11.757l1.414-1.414 2.829 2.829 5.656-5.657 1.415 1.414L11.003 16z" fill="rgba(47,204,113,1)"/></svg></div>
  84. <div class="dz-error-mark"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="54" height="54"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm0-2a8 8 0 1 0 0-16 8 8 0 0 0 0 16zm0-9.414l2.828-2.829 1.415 1.415L13.414 12l2.829 2.828-1.415 1.415L12 13.414l-2.828 2.829-1.415-1.415L10.586 12 7.757 9.172l1.415-1.415L12 10.586z" fill="rgba(231,76,60,1)"/></svg></div>
  85. </div> `
  86. const $dropzone = $('div#dataset');
  87. const dropzoneUploader = await createDropzone($dropzone[0], {
  88. url: '/todouploader',
  89. maxFiles: this.maxFiles,
  90. maxFilesize: 1024*200,
  91. filesizeBase:1024,
  92. parallelUploads: this.maxFiles,
  93. timeout: 0,
  94. addRemoveLinks:true,
  95. // autoQueue: false,
  96. autoProcessQueue: false, //自动上传
  97. dictDefaultMessage: this.dropzoneParams.data('default-message'),
  98. dictInvalidFileType: this.dropzoneParams.data('invalid-input-type'),
  99. dictFileTooBig: this.dropzoneParams.data('file-too-big'),
  100. dictRemoveFile: this.dropzoneParams.data('remove-file'),
  101. previewTemplate:previewTemplate
  102. });
  103. dropzoneUploader.on('addedfile', (file) => {
  104. if(file.size/(1024*1024)>dropzoneUploader.options.maxFilesize){
  105. dropzoneUploader.removeFile(file)
  106. $('.maxfilesize.ui.red.message').text("单次最多上传10个文件,单个文件不超过200G")
  107. $('.maxfilesize.ui.red.message').css('display','block')
  108. }else{
  109. this.file = file
  110. $('.maxfilesize.ui.red.message').css('display','none')
  111. }
  112. });
  113. dropzoneUploader.on("removedfile",(file)=>{
  114. $('.maxfilesize.ui.red.message').css('display','none')
  115. })
  116. dropzoneUploader.on('maxfilesexceeded', function (file) {
  117. dropzoneUploader.removeFile(file)
  118. $('.maxfilesize.ui.red.message').text("单次最多上传10个文件,单个文件不超过200G")
  119. $('.maxfilesize.ui.red.message').css('display','block')
  120. });
  121. this.dropzoneUploader = dropzoneUploader;
  122. },
  123. watch:{
  124. allUploadLength(len){
  125. if(len===this.uploadFiles.length){
  126. setTimeout(() => {
  127. this.dropzoneUploader.removeAllFiles(true)
  128. this.btnFlag = false
  129. this.$emit('setcluster',this.btnFlag)
  130. }, 2000);
  131. }
  132. }
  133. },
  134. methods: {
  135. startUpload(){
  136. this.uploadFiles = this.dropzoneUploader.getQueuedFiles()
  137. if(this.uploadFiles.length===0){
  138. return
  139. }
  140. this.resetStatus()
  141. $('.dz-remove').remove()
  142. $('.maxfilesize.ui.red.message').css('display','none')
  143. this.btnFlag = true
  144. this.$emit('setcluster',this.btnFlag)
  145. this.uploadFiles.forEach(element => {
  146. element.datasetId = document.getElementById('datasetId').getAttribute('datasetId')
  147. this.computeMD5(element)
  148. });
  149. },
  150. cancelDataset(){
  151. location.href = this.repoPath
  152. this.dropzoneUploader.removeAllFiles(true)
  153. },
  154. resetStatus() {
  155. this.uploadLength = 0
  156. this.allUploadLength = 0
  157. this.allUploadFiles = []
  158. },
  159. updateProgress(file, progress) {
  160. file.previewTemplate.querySelector(
  161. '.dz-upload'
  162. ).style.width = `${progress}%`
  163. file.previewTemplate.querySelector(
  164. '.dz-upload'
  165. ).style.background = '#409eff';
  166. },
  167. uploadError(file,info){
  168. file.previewTemplate.querySelector(
  169. '.dz-error-mark'
  170. ).style.opacity = 1
  171. file.previewTemplate.querySelector(
  172. '.dz-progress'
  173. ).style.opacity = 0
  174. file.previewTemplate.querySelector(
  175. '.dz-error-message span'
  176. ).innerHTML = info
  177. file.previewTemplate.querySelector(
  178. '.dz-error-message'
  179. ).style.display = 'block'
  180. file.previewTemplate.querySelector(
  181. '.dz-details'
  182. ).onmouseover = function(){file.previewTemplate.querySelector('.dz-error-message').style.opacity = 1 }
  183. file.previewTemplate.querySelector(
  184. '.dz-details'
  185. ).onmouseout = function(){file.previewTemplate.querySelector('.dz-error-message').style.opacity = 0 }
  186. },
  187. emitDropzoneSuccess(file) {
  188. file.status = 'success';
  189. this.dropzoneUploader.emit('success', file);
  190. this.dropzoneUploader.emit('complete', file);
  191. },
  192. emitDropzoneFailed(file) {
  193. this.status = this.dropzoneParams.data('falied');
  194. file.status = 'error';
  195. this.dropzoneUploader.emit('error', file);
  196. // this.dropzoneUploader.emit('complete', file);
  197. },
  198. finishUpload(file) {
  199. console.log("finish",file)
  200. file.previewTemplate.querySelector(
  201. '.dz-success-mark'
  202. ).style.opacity = 1
  203. file.previewTemplate.querySelector(
  204. '.dz-progress'
  205. ).style.opacity = 0
  206. if(this.uploadLength === this.uploadFiles.length){
  207. setTimeout(() => {
  208. window.location.href = this.repoPath
  209. }, 1000);
  210. }
  211. },
  212. computeMD5(file) {
  213. const blobSlice =
  214. File.prototype.slice ||
  215. File.prototype.mozSlice ||
  216. File.prototype.webkitSlice,
  217. chunks = Math.ceil(file.size / chunkSize),
  218. spark = new SparkMD5.ArrayBuffer(),
  219. fileReader = new FileReader();
  220. let currentChunk = 0;
  221. const time = new Date().getTime();
  222. this.status = this.dropzoneParams.data('md5-computing');
  223. file.totalChunkCounts = chunks;
  224. if (file.size==0) {
  225. file.totalChunkCounts = 1
  226. }
  227. loadMd5Next();
  228. fileReader.onload = (e) => {
  229. fileLoaded.call(this, e);
  230. };
  231. fileReader.onerror = (err) => {
  232. console.warn('oops, something went wrong.', err);
  233. file.cancel();
  234. };
  235. function fileLoaded(e) {
  236. spark.append(e.target.result); // Append array buffer
  237. currentChunk++;
  238. if (currentChunk < chunks) {
  239. this.status = `${this.dropzoneParams.data('loading-file')} ${(
  240. (currentChunk / chunks) *
  241. 100
  242. ).toFixed(2)}% (${currentChunk}/${chunks})`;
  243. this.updateProgress(file, ((currentChunk / chunks) * 100).toFixed(2));
  244. loadMd5Next();
  245. return;
  246. }
  247. const md5 = spark.end();
  248. console.log(
  249. `MD5计算完成:${file.name} \nMD5:${md5} \n分片:${chunks} 大小:${
  250. file.size
  251. } 用时:${(new Date().getTime() - time) / 1000} s`
  252. );
  253. this.updateProgress(file,100)
  254. spark.destroy(); // 释放缓存
  255. file.uniqueIdentifier = md5; // 将文件md5赋值给文件唯一标识
  256. file.cmd5 = false; // 取消计算md5状态
  257. this.computeMD5Success(file);
  258. }
  259. function loadNext() {
  260. const start = currentChunk * chunkSize;
  261. const end =
  262. start + chunkSize >= file.size ? file.size : start + chunkSize;
  263. fileReader.readAsArrayBuffer(blobSlice.call(file, start, end));
  264. }
  265. function loadMd5Next() {
  266. const start = currentChunk * chunkSize;
  267. const end =
  268. start + md5ChunkSize >= file.size ? file.size : start + md5ChunkSize;
  269. fileReader.readAsArrayBuffer(blobSlice.call(file, start, end));
  270. }
  271. },
  272. async computeMD5Success(md5edFile) {
  273. const file = await this.getSuccessChunks(md5edFile);
  274. try {
  275. if (file.uploadID == '' || file.uuid == '') {
  276. // 未上传过
  277. await this.newMultiUpload(file);
  278. if (file.uploadID != '' && file.uuid != '') {
  279. file.chunks = '';
  280. this.multipartUpload(file);
  281. } else {
  282. // 失败如何处理
  283. let info = "上传失败"
  284. this.allUploadLength++
  285. this.uploadError(file,info)
  286. this.allUploadFiles.push({name:file.name,status:2,info:info})
  287. return;
  288. }
  289. return;
  290. }
  291. if (file.uploaded == '1') {
  292. // 已上传成功
  293. // 秒传
  294. if (file.attachID == '0') {
  295. // 删除数据集记录,未删除文件
  296. await addAttachment(file);
  297. }
  298. //不同数据集上传同一个文件
  299. if (file.datasetID != '') {
  300. if (file.datasetName != "" && file.realName != "") {
  301. let info = `该文件已上传在数据集: ${file.datasetName}`
  302. this.uploadError(file,info)
  303. this.allUploadLength++
  304. this.allUploadFiles.push({name:file.name,status:1,info:info})
  305. }
  306. }
  307. console.log('文件已上传完成');
  308. this.progress = 100;
  309. this.status = this.dropzoneParams.data('upload-complete');
  310. // this.finishUpload(file);
  311. } else {
  312. // 断点续传
  313. this.multipartUpload(file);
  314. }
  315. } catch (error) {
  316. this.emitDropzoneFailed(file);
  317. console.log(error);
  318. }
  319. async function addAttachment(file) {
  320. return await axios.post(
  321. '/attachments/add',
  322. qs.stringify({
  323. uuid: file.uuid,
  324. file_name: file.name,
  325. size: file.size,
  326. dataset_id: file.datasetId,
  327. type: this.uploadtype,
  328. _csrf: csrf
  329. })
  330. );
  331. }
  332. },
  333. async getSuccessChunks(file) {
  334. const params = {
  335. params: {
  336. md5: file.uniqueIdentifier,
  337. type: this.uploadtype,
  338. file_name: file.name,
  339. _csrf: csrf
  340. }
  341. };
  342. try {
  343. const response = await axios.get('/attachments/get_chunks', params);
  344. file.uploadID = response.data.uploadID;
  345. file.uuid = response.data.uuid;
  346. file.uploaded = response.data.uploaded;
  347. file.chunks = response.data.chunks;
  348. file.attachID = response.data.attachID;
  349. file.datasetID = response.data.datasetID;
  350. file.datasetName = response.data.datasetName;
  351. file.realName = response.data.fileName;
  352. return file;
  353. } catch (error) {
  354. this.emitDropzoneFailed(file);
  355. console.log('getSuccessChunks catch: ', error);
  356. return null;
  357. }
  358. },
  359. async newMultiUpload(file) {
  360. const res = await axios.get('/attachments/new_multipart', {
  361. params: {
  362. totalChunkCounts: file.totalChunkCounts,
  363. md5: file.uniqueIdentifier,
  364. size: file.size,
  365. fileType: file.type,
  366. type: this.uploadtype,
  367. file_name: file.name,
  368. _csrf: csrf
  369. }
  370. });
  371. file.uploadID = res.data.uploadID;
  372. file.uuid = res.data.uuid;
  373. },
  374. multipartUpload(file) {
  375. const blobSlice =
  376. File.prototype.slice ||
  377. File.prototype.mozSlice ||
  378. File.prototype.webkitSlice,
  379. chunks = Math.ceil(file.size / chunkSize),
  380. fileReader = new FileReader(),
  381. time = new Date().getTime();
  382. let currentChunk = 0;
  383. let _this = this
  384. function loadNext() {
  385. const start = currentChunk * chunkSize;
  386. const end =
  387. start + chunkSize >= file.size ? file.size : start + chunkSize;
  388. fileReader.readAsArrayBuffer(blobSlice.call(file, start, end));
  389. }
  390. function checkSuccessChunks() {
  391. const index = successChunks.indexOf((currentChunk + 1).toString());
  392. if (index == -1) {
  393. return false;
  394. }
  395. return true;
  396. }
  397. async function getUploadChunkUrl(currentChunk, partSize) {
  398. const res = await axios.get('/attachments/get_multipart_url', {
  399. params: {
  400. uuid: file.uuid,
  401. uploadID: file.uploadID,
  402. size: partSize,
  403. chunkNumber: currentChunk + 1,
  404. type: _this.uploadtype,
  405. file_name: file.name,
  406. _csrf: csrf
  407. }
  408. });
  409. urls[currentChunk] = res.data.url;
  410. }
  411. async function uploadMinio(url, e) {
  412. const res = await axios.put(url, e.target.result);
  413. delete e.target.result
  414. etags[currentChunk] = res.headers.etag;
  415. }
  416. async function uploadMinioNewMethod(url,e){
  417. var xhr = new XMLHttpRequest();
  418. xhr.open('PUT', url, false);
  419. if(_this.uploadtype===0){
  420. xhr.setRequestHeader('Content-Type', 'text/plain')
  421. xhr.send(e.target.result);
  422. var etagValue = xhr.getResponseHeader('etag');
  423. etags[currentChunk] = etagValue;
  424. }
  425. else if(_this.uploadtype===1){
  426. xhr.setRequestHeader('Content-Type', '')
  427. xhr.send(e.target.result);
  428. var etagValue = xhr.getResponseHeader('ETag');
  429. //console.log(etagValue);
  430. etags[currentChunk] = etagValue;
  431. }
  432. }
  433. async function updateChunk(currentChunk) {
  434. await axios.post(
  435. '/attachments/update_chunk',
  436. qs.stringify({
  437. uuid: file.uuid,
  438. chunkNumber: currentChunk + 1,
  439. etag: etags[currentChunk],
  440. _csrf: csrf
  441. })
  442. );
  443. }
  444. async function uploadChunk(e) {
  445. try {
  446. if (!checkSuccessChunks()) {
  447. const start = currentChunk * chunkSize;
  448. const partSize =
  449. start + chunkSize >= file.size ? file.size - start : chunkSize;
  450. // 获取分片上传url
  451. await getUploadChunkUrl(currentChunk, partSize);
  452. if (urls[currentChunk] != '') {
  453. // 上传到minio
  454. //await uploadMinio(urls[currentChunk], e);
  455. await uploadMinioNewMethod(urls[currentChunk], e);
  456. if (etags[currentChunk] != '') {
  457. // 更新数据库:分片上传结果
  458. //await updateChunk(currentChunk);
  459. } else {
  460. console.log("上传到minio uploadChunk etags[currentChunk] == ''");// TODO
  461. }
  462. } else {
  463. console.log("uploadChunk urls[currentChunk] != ''");// TODO
  464. }
  465. }
  466. } catch (error) {
  467. console.log(error);
  468. //this.emitDropzoneFailed(file);
  469. //console.log(error);
  470. }
  471. }
  472. async function completeUpload() {
  473. return await axios.post(
  474. '/attachments/complete_multipart',
  475. qs.stringify({
  476. uuid: file.uuid,
  477. uploadID: file.uploadID,
  478. file_name: file.name,
  479. size: file.size,
  480. dataset_id: file.datasetId,
  481. type: _this.uploadtype,
  482. _csrf: csrf,
  483. description:_this.desc
  484. })
  485. );
  486. }
  487. const successChunks = [];
  488. let successParts = [];
  489. successParts = file.chunks.split(',');
  490. for (let i = 0; i < successParts.length; i++) {
  491. successChunks[i] = successParts[i].split('-')[0];
  492. }
  493. const urls = []; // TODO const ?
  494. const etags = [];
  495. console.log('上传分片...');
  496. this.status = this.dropzoneParams.data('uploading');
  497. loadNext();
  498. fileReader.onload = async (e) => {
  499. try{
  500. await uploadChunk(e);
  501. }catch(err){
  502. console.log(err)
  503. }
  504. fileReader.abort();
  505. currentChunk++;
  506. if (currentChunk < chunks) {
  507. console.log(
  508. `第${currentChunk}个分片上传完成, 开始第${currentChunk +
  509. 1}/${chunks}个分片上传`
  510. );
  511. this.progress = Math.ceil((currentChunk / chunks) * 100);
  512. this.updateProgress(file, ((currentChunk / chunks) * 100).toFixed(2));
  513. this.status = `${this.dropzoneParams.data('uploading')} ${(
  514. (currentChunk / chunks) *
  515. 100
  516. ).toFixed(2)}%`;
  517. await loadNext();
  518. } else {
  519. try{
  520. await completeUpload();
  521. }catch(err){
  522. let info = "上传失败"
  523. this.allUploadLength++
  524. this.uploadError(file,info)
  525. this.allUploadFiles.push({name:file.name,status:2,info:info})
  526. if(err){
  527. return
  528. }
  529. }
  530. console.log(
  531. `文件上传完成:${file.name} \n分片:${chunks} 大小:${
  532. file.size
  533. } 用时:${(new Date().getTime() - time) / 1000} s`
  534. );
  535. this.uploadLength++
  536. this.allUploadLength++
  537. this.allUploadFiles.push({name:file.name,status:0,info:'上传成功'})
  538. this.updateProgress(file, 100);
  539. this.progress = 100;
  540. this.status = this.dropzoneParams.data('upload-complete');
  541. this.finishUpload(file);
  542. }
  543. };
  544. }
  545. }
  546. };
  547. </script>
  548. <style>
  549. .dropzone-wrapper {
  550. margin: 0;
  551. }
  552. .ui .dropzone {
  553. border: 2px dashed #0087f5;
  554. box-shadow: none !important;
  555. padding: 0;
  556. min-height: 5rem;
  557. border-radius: 4px;
  558. }
  559. .dataset .dataset-files #dataset .dz-preview.dz-file-preview,
  560. .dataset .dataset-files #dataset .dz-preview.dz-processing {
  561. display: flex;
  562. align-items: center;
  563. }
  564. .dataset .dataset-files #dataset .dz-preview {
  565. border-bottom: 1px solid #dadce0;
  566. min-height: 0;
  567. }
  568. .upload-info{
  569. margin-top: 1em;
  570. margin-bottom: 3em;
  571. }
  572. .success{
  573. color: #21ba45;
  574. }
  575. .failed{
  576. color: red;
  577. }
  578. </style>