Browse Source

12.12

master
lichong 1 week ago
parent
commit
3802b656ab
  1. 8
      src/main/index.js
  2. 32
      src/renderer/src/views/dangan.vue

8
src/main/index.js

@ -142,6 +142,12 @@ app.whenReady().then(() => {
let paramsObj = JSON.parse(paramsStr)
mainWindow.webContents.send(`delFileResult`, paramsObj)
})
// 删除所有文件
ipcMain.on('deleteFolder', (e, paramsStr) => {
try {
fs.rmdirSync(paramsStr, { recursive: true })
} catch (e) { }
})
// 打开文件
ipcMain.on('openFile', (e, pathStr) => {
let filePath = path.join("D:\\test\\", pathStr.replace("D:\\test\\", ""));
@ -168,7 +174,7 @@ app.whenReady().then(() => {
let errorFolderList = []
for (let index = 0; index < pathList.length; index++) {
let element = pathList[index];
let folderPath = path.join("D:\\test\\", element);
let folderPath = path.join("D:\\test\\", element.replace("D:\\test\\", ""));
folderPath = Buffer.from(folderPath, 'utf8').toString('utf8');
try {
fs.mkdirSync(`${folderPath}\\`, { recursive: true });

32
src/renderer/src/views/dangan.vue

@ -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: '您取消删除数据库,数据仍然存在',

Loading…
Cancel
Save