|
@@ -376,7 +376,7 @@
|
|
</template>
|
|
</template>
|
|
</vxe-column>
|
|
</vxe-column>
|
|
<vxe-column field="path" title="文件位置" width="200"></vxe-column>
|
|
<vxe-column field="path" title="文件位置" width="200"></vxe-column>
|
|
- <vxe-column field="status" title="状态" width="180">
|
|
|
|
|
|
+ <vxe-column field="status" title="状态" width="260">
|
|
<template #default="{ row }">
|
|
<template #default="{ row }">
|
|
<template v-if="row.status == '1'">
|
|
<template v-if="row.status == '1'">
|
|
<i class="el-icon-info" style="font-size: 16px; color: #999;"></i>
|
|
<i class="el-icon-info" style="font-size: 16px; color: #999;"></i>
|
|
@@ -399,14 +399,25 @@
|
|
<span>文件已存在</span>
|
|
<span>文件已存在</span>
|
|
</template>
|
|
</template>
|
|
<template v-if="row.status == '6'">
|
|
<template v-if="row.status == '6'">
|
|
- <template v-if="row.searchList && row.searchList.length > row.total">
|
|
|
|
- <i class="el-icon-loading" style="font-size: 16px; color: #999;"></i>
|
|
|
|
- <span>提取中<span v-if="row.searchList">,共{{row.searchList.length}}个,{{row.total}}</span></span>
|
|
|
|
- </template>
|
|
|
|
- <template v-else>
|
|
|
|
|
|
+ <template v-if="mergeData.extractType == '1'">
|
|
<i class="el-icon-success" style="font-size: 16px; color: #19be6b;"></i>
|
|
<i class="el-icon-success" style="font-size: 16px; color: #19be6b;"></i>
|
|
- <span>提取成功<span v-if="row.searchList">,共{{row.searchList.length}}个,{{row.total}}</span></span>
|
|
|
|
|
|
+ <span>提取成功,成功{{row.total}}个</span>
|
|
|
|
+ </template>
|
|
|
|
+
|
|
|
|
+ <template v-if="mergeData.extractType != '1'">
|
|
|
|
+ <template v-if="row.searchList.length > row.total + row.error">
|
|
|
|
+ <i class="el-icon-loading" style="font-size: 16px; color: #999;"></i>
|
|
|
|
+ <span v-if="row.searchList.length > 0">提取中,共{{row.searchList.length}}个,成功{{row.total}}个</span>
|
|
|
|
+ <span v-else>提取中,成功{{row.total}}个</span>
|
|
|
|
+ </template>
|
|
|
|
+ <template v-else>
|
|
|
|
+ <i class="el-icon-success" style="font-size: 16px; color: #19be6b;"></i>
|
|
|
|
+ <span v-if="row.searchList.length > 0">提取成功,共{{row.searchList.length}}个,成功{{row.total}}个</span>
|
|
|
|
+ <span v-else>提取成功,成功{{row.total}}个</span>
|
|
|
|
+ </template>
|
|
</template>
|
|
</template>
|
|
|
|
+
|
|
|
|
+
|
|
</template>
|
|
</template>
|
|
</template>
|
|
</template>
|
|
</vxe-column>
|
|
</vxe-column>
|
|
@@ -453,11 +464,21 @@
|
|
<div class="handle-item">
|
|
<div class="handle-item">
|
|
<label class="handle-label">文件类型:</label>
|
|
<label class="handle-label">文件类型:</label>
|
|
<el-select v-model="mergeData.fileType" style="width:150px;" size="small" >
|
|
<el-select v-model="mergeData.fileType" style="width:150px;" size="small" >
|
|
- <el-option value="1" label="图片"></el-option>
|
|
|
|
- <el-option value="2" label="视频"></el-option>
|
|
|
|
- <el-option value="3" label="文本"></el-option>
|
|
|
|
|
|
+ <el-option value="1" label="图片格式"></el-option>
|
|
|
|
+ <el-option value="2" label="视频格式"></el-option>
|
|
|
|
+ <el-option value="3" label="文本文档"></el-option>
|
|
</el-select>
|
|
</el-select>
|
|
</div>
|
|
</div>
|
|
|
|
+
|
|
|
|
+ <el-popover placement="left" popper-class="popper-open" trigger="hover" content="内容">
|
|
|
|
+ <div>
|
|
|
|
+ <p>图片格式包含:jpg,jpeg,png,gif,bmp,ico,webp,heic,jfif,tif,tiff,svg,psd,ai,cdr,wmf</p>
|
|
|
|
+ <p>视频格式包含:mp4,avi,mov,wmv,flv,mkv,webm,m4v,3gp,mpeg,mpg,rmvb,ts,vob,rm,ram,swf</p>
|
|
|
|
+ <p>文本文档包含:txt,doc,docx,ppt,pptx,xls,xlsx,pdf</p>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <div slot="reference" class="i-tips">点击查看提取的文件类型</div>
|
|
|
|
+ </el-popover>
|
|
</template>
|
|
</template>
|
|
<template v-if="mergeData.extractType == '3'">
|
|
<template v-if="mergeData.extractType == '3'">
|
|
<el-divider content-position="left">提取包含以下名称的文件</el-divider>
|
|
<el-divider content-position="left">提取包含以下名称的文件</el-divider>
|
|
@@ -1220,7 +1241,8 @@ export default {
|
|
path: dirs[i].slice(0, lastIndex+1),
|
|
path: dirs[i].slice(0, lastIndex+1),
|
|
status: "1",
|
|
status: "1",
|
|
searchList: [],
|
|
searchList: [],
|
|
- total: 0
|
|
|
|
|
|
+ total: 0,
|
|
|
|
+ error: 0
|
|
};
|
|
};
|
|
|
|
|
|
if(this.dirList.length == 0){
|
|
if(this.dirList.length == 0){
|
|
@@ -1945,7 +1967,27 @@ export default {
|
|
this.traverseDirectoryIteratively(i, this.mergeData.newPath, 'folder').catch(console.error);
|
|
this.traverseDirectoryIteratively(i, this.mergeData.newPath, 'folder').catch(console.error);
|
|
break;
|
|
break;
|
|
case "2": // 按类型提取
|
|
case "2": // 按类型提取
|
|
-
|
|
|
|
|
|
+ (async () => {
|
|
|
|
+ let ruleStr = [];
|
|
|
|
+ let searchDir = item.path.replace(/\\/g, '/') + item.name;
|
|
|
|
+ let suffixStr = '';
|
|
|
|
+ switch(this.mergeData.fileType){
|
|
|
|
+ case '1':
|
|
|
|
+ suffixStr = '{jpg,jpeg,png,gif,bmp,ico,webp,heic,jfif,tif,tiff,svg,psd,ai,cdr,wmf}';
|
|
|
|
+ break;
|
|
|
|
+ case '2':
|
|
|
|
+ suffixStr = '{mp4,avi,mov,wmv,flv,mkv,webm,m4v,3gp,mpeg,mpg,rmvb,ts,vob,rm,ram,swf}';
|
|
|
|
+ break;
|
|
|
|
+ case '3':
|
|
|
|
+ suffixStr = '{txt,doc,docx,ppt,pptx,xls,xlsx,pdf}';
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ ruleStr.push(searchDir + '/**/' + '*.' + suffixStr);
|
|
|
|
+ const files = await fg(ruleStr, { dot: true, caseSensitiveMatch: false});
|
|
|
|
+ this.dirList[i].searchList = files;
|
|
|
|
+
|
|
|
|
+ this.traverseDirectoryIteratively(i, this.mergeData.newPath, 'files').catch(console.error);
|
|
|
|
+ })();
|
|
break;
|
|
break;
|
|
case "3": // 按名称提取
|
|
case "3": // 按名称提取
|
|
(async () => {
|
|
(async () => {
|
|
@@ -1974,6 +2016,8 @@ export default {
|
|
ruleStr.push(searchDir + '/**/' + '*.' + this.mergeData.suffixName);
|
|
ruleStr.push(searchDir + '/**/' + '*.' + this.mergeData.suffixName);
|
|
const files = await fg(ruleStr, { dot: true });
|
|
const files = await fg(ruleStr, { dot: true });
|
|
this.dirList[i].searchList = files;
|
|
this.dirList[i].searchList = files;
|
|
|
|
+
|
|
|
|
+ this.traverseDirectoryIteratively(i, this.mergeData.newPath, 'files').catch(console.error);
|
|
})();
|
|
})();
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -1983,6 +2027,12 @@ export default {
|
|
},
|
|
},
|
|
// 按文件夹提取文件
|
|
// 按文件夹提取文件
|
|
async traverseDirectoryIteratively(index, newPath, type) {
|
|
async traverseDirectoryIteratively(index, newPath, type) {
|
|
|
|
+ let authority = this.$refs.headerRef.authority;
|
|
|
|
+ let size = 999999999;
|
|
|
|
+ if(!authority.isAuthority){
|
|
|
|
+ size = 5;
|
|
|
|
+ }
|
|
|
|
+
|
|
const fs = require('fs').promises;
|
|
const fs = require('fs').promises;
|
|
if(!this.dirList[index].total){
|
|
if(!this.dirList[index].total){
|
|
this.dirList[index].total = 0;
|
|
this.dirList[index].total = 0;
|
|
@@ -2007,14 +2057,17 @@ export default {
|
|
if (entry.isDirectory()) {
|
|
if (entry.isDirectory()) {
|
|
queue.push(fullPath); // 将子目录添加到队列中以便后续遍历
|
|
queue.push(fullPath); // 将子目录添加到队列中以便后续遍历
|
|
} else if (entry.isFile()) {
|
|
} else if (entry.isFile()) {
|
|
- // 处理文件
|
|
|
|
- console.log(`Found file: ${fullPath}`);
|
|
|
|
|
|
+ // 处理文件 console.log(`Found file: ${fullPath}`);
|
|
let targetPath = newPath + separator + entry.name;
|
|
let targetPath = newPath + separator + entry.name;
|
|
- await fs.copyFile(fullPath, targetPath);
|
|
|
|
- this.dirList[index].total += 1;
|
|
|
|
|
|
+ if(this.dirList[index].total < size){
|
|
|
|
+ await fs.copyFile(fullPath, targetPath);
|
|
|
|
+ this.dirList[index].total += 1;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} catch (err) {
|
|
} catch (err) {
|
|
|
|
+ this.dirList[index].error += 1;
|
|
console.error(`Unable to scan directory: ${currentPath}, Error: ${err}`);
|
|
console.error(`Unable to scan directory: ${currentPath}, Error: ${err}`);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -2024,8 +2077,14 @@ export default {
|
|
for (const entry of this.dirList[index].searchList) {
|
|
for (const entry of this.dirList[index].searchList) {
|
|
let filename = entry.substr(entry.lastIndexOf('/')+1);
|
|
let filename = entry.substr(entry.lastIndexOf('/')+1);
|
|
let targetPath = newPath + separator + filename;
|
|
let targetPath = newPath + separator + filename;
|
|
- await fs.copyFile(entry, targetPath);
|
|
|
|
- this.dirList[index].total += 1;
|
|
|
|
|
|
+ if(this.dirList[index].total < size){
|
|
|
|
+ await fs.copyFile(entry, targetPath);
|
|
|
|
+ this.dirList[index].total += 1;
|
|
|
|
+ if(this.dirList[index].total > this.dirList[index].searchList.length){
|
|
|
|
+ this.dirList[index].total = this.dirList[index].searchList.length;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
} catch (err) {
|
|
} catch (err) {
|
|
console.error(`Unable to scan directory: Error: ${err}`);
|
|
console.error(`Unable to scan directory: Error: ${err}`);
|