|
|
@ -311,6 +311,7 @@ export default { |
|
|
|
xiangmuList.push(key) |
|
|
|
} |
|
|
|
} |
|
|
|
xiangmuList = _.sortBy(xiangmuList) |
|
|
|
let { pathList, treeList } = that.bulkAddXiangmu(xiangmuList) |
|
|
|
let { tableList } = that.bulkAddFile(treeList, sheetData) |
|
|
|
that.inputTreeList = _.cloneDeep(treeList) |
|
|
@ -383,11 +384,13 @@ export default { |
|
|
|
|
|
|
|
// 批量新增文件 |
|
|
|
bulkAddFile(treeList, tableDataList) { |
|
|
|
console.log(386, tableDataList); |
|
|
|
let tableList = [] |
|
|
|
for (let i = 0; i < tableDataList.length; i++) { |
|
|
|
let fileItem = tableDataList[i]; |
|
|
|
let juanNameLIst = _.split(fileItem["文件名"], "·") |
|
|
|
let fileNameTemp = fileItem["文件名"].replaceAll(" ", "") |
|
|
|
let juanNameLIst = _.split(fileNameTemp, "·") |
|
|
|
let juanNameLIstTemp = _.cloneDeep(juanNameLIst) |
|
|
|
juanNameLIstTemp.splice(juanNameLIstTemp.length - 1, 0, i) |
|
|
|
if (juanNameLIst) { |
|
|
|
let pdfText = juanNameLIst[juanNameLIst.length - 1]; |
|
|
|
// 使用正则表达式只保留汉字 |
|
|
@ -395,7 +398,13 @@ export default { |
|
|
|
let juanName = chineseCharsOnly ? chineseCharsOnly.join('') : ''; |
|
|
|
let treeItem = _.find(treeList, o => o.path === `${fileItem["项目名"]}\\${fileItem["卷名"]}\\${juanName}`) |
|
|
|
let treeItem1 = _.find(treeList, o => _.startsWith(o.path, `${fileItem["项目名"]}\\${fileItem["卷名"]}`) && juanName.includes(o.label)) |
|
|
|
if (!treeItem1) { |
|
|
|
treeItem1 = _.find(treeList, o => _.startsWith(o.path, `${fileItem["项目名"]}\\${fileItem["卷名"]}`)) |
|
|
|
} |
|
|
|
let treeItem2 = _.find(treeList, o => _.startsWith(o.path, `${fileItem["项目名"]}}`) && juanName.includes(o.label)) |
|
|
|
if (!treeItem2) { |
|
|
|
treeItem2 = _.find(treeList, o => _.startsWith(o.path, `${fileItem["项目名"]}}`)) |
|
|
|
} |
|
|
|
let path = _.split(fileItem["储存位置"], "_") |
|
|
|
let fileType = _.find(this.fileList, o => o.label === path[1].split(".")[1]) |
|
|
|
let prepath = _.split(fileItem["储存位置"], "uploadPath/") |
|
|
@ -406,12 +415,12 @@ export default { |
|
|
|
prepretreeId: treeItem.prepreId, |
|
|
|
xiangmuName: fileItem["项目名"], |
|
|
|
juanName: `${fileItem["卷名"]}_${juanName}`, |
|
|
|
fileName: path[1], |
|
|
|
fileName: fileNameTemp, |
|
|
|
fileType: (fileType || {}).value, |
|
|
|
uploadTime: fileItem["上传时间"], |
|
|
|
status: fileItem["状态"], |
|
|
|
size: "", |
|
|
|
path: `D: \\test\\${fileItem["项目名"]}\\${fileItem["卷名"]}\\${juanName}\\${path[1]}`, |
|
|
|
path: `D:\\test\\${fileItem["项目名"]}\\${fileItem["卷名"]}\\${juanName}\\${_.join(juanNameLIstTemp, ".")}`, |
|
|
|
prePath: `D:\\uploadPath\\${prepath[1].replaceAll("/", "\\")}`, |
|
|
|
note: fileItem["备注"], |
|
|
|
create_at: dayjs().format('YYYY-MM-DD HH:mm:ss'), |
|
|
@ -424,12 +433,12 @@ export default { |
|
|
|
prepretreeId: treeItem1.prepreId, |
|
|
|
xiangmuName: fileItem["项目名"], |
|
|
|
juanName: `${fileItem["卷名"]}`, |
|
|
|
fileName: path[1], |
|
|
|
fileName: fileNameTemp, |
|
|
|
fileType: (fileType || {}).value, |
|
|
|
uploadTime: fileItem["上传时间"], |
|
|
|
status: fileItem["状态"], |
|
|
|
size: "", |
|
|
|
path: `D: \\test\\${fileItem["项目名"]}\\${fileItem["卷名"]}\\${path[1]}`, |
|
|
|
path: `D:\\test\\${fileItem["项目名"]}\\${fileItem["卷名"]}\\${_.join(juanNameLIstTemp, ".")}`, |
|
|
|
prePath: `D:\\uploadPath\\${prepath[1].replaceAll("/", "\\")}`, |
|
|
|
note: fileItem["备注"], |
|
|
|
create_at: dayjs().format('YYYY-MM-DD HH:mm:ss'), |
|
|
@ -442,12 +451,12 @@ export default { |
|
|
|
prepretreeId: treeItem2.prepreId, |
|
|
|
xiangmuName: fileItem["项目名"], |
|
|
|
juanName: `${fileItem["卷名"]}_${juanName}`, |
|
|
|
fileName: path[1], |
|
|
|
fileName: fileNameTemp, |
|
|
|
fileType: (fileType || {}).value, |
|
|
|
uploadTime: fileItem["上传时间"], |
|
|
|
status: fileItem["状态"], |
|
|
|
size: "", |
|
|
|
path: `D: \\test\\${fileItem["项目名"]}\\${path[1]}`, |
|
|
|
path: `D:\\test\\${fileItem["项目名"]}\\${_.join(juanNameLIstTemp, ".")}`, |
|
|
|
prePath: `D:\\uploadPath\\${prepath[1].replaceAll("/", "\\")}`, |
|
|
|
note: fileItem["备注"], |
|
|
|
create_at: dayjs().format('YYYY-MM-DD HH:mm:ss'), |
|
|
@ -764,8 +773,7 @@ export default { |
|
|
|
cancelButtonText: '取消', |
|
|
|
type: 'error', |
|
|
|
} |
|
|
|
) |
|
|
|
.then(async () => { |
|
|
|
).then(async () => { |
|
|
|
// 清空数据库 |
|
|
|
let db = await myDatabase.open(); |
|
|
|
// 获取所有表(对象存储)名称 |
|
|
@ -775,13 +783,13 @@ export default { |
|
|
|
let tableName = tableNames[index]; |
|
|
|
await myDatabase[tableName].clear(); |
|
|
|
} |
|
|
|
window.electron.ipcRenderer.send('deleteFolder', "D:\\test") |
|
|
|
await this.searchTree() |
|
|
|
ElMessage({ |
|
|
|
type: 'error', |
|
|
|
message: '您已经删除数据库,数据全部清空了!!!', |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
}).catch(() => { |
|
|
|
ElMessage({ |
|
|
|
type: 'success', |
|
|
|
message: '您取消删除数据库,数据仍然存在', |
|
|
|