|
|
@ -60,7 +60,8 @@ |
|
|
|
<div style="margin-bottom: 8px;"> |
|
|
|
<el-row :gutter="20"> |
|
|
|
<el-col :span="4"> |
|
|
|
<el-button type="primary" plain @click="addFile" :disabled="_.get(treeNode, 'level') !== 3"> |
|
|
|
<!-- <el-button type="primary" plain @click="addFile" :disabled="_.get(treeNode, 'level') !== 3"> --> |
|
|
|
<el-button type="primary" plain @click="addFile" :disabled="[1].includes(_.get(treeNode, 'level', 1))"> |
|
|
|
<el-icon> |
|
|
|
<Plus /> |
|
|
|
</el-icon> |
|
|
@ -490,20 +491,22 @@ export default { |
|
|
|
this.tableLoading = true |
|
|
|
let collection = myDatabase.fileList |
|
|
|
if (!_.isEmpty(this.treeNode)) { |
|
|
|
if (this.treeNode.level === 1) { |
|
|
|
collection = collection.filter((equip) => equip.prepretreeId === this.treeNode.currentId) |
|
|
|
} else if (this.treeNode.level === 2) { |
|
|
|
collection = collection.filter((equip) => equip.pretreeId === this.treeNode.currentId) |
|
|
|
} else if (this.treeNode.level === 3) { |
|
|
|
collection = collection.filter((equip) => equip.treeId === this.treeNode.currentId) |
|
|
|
} |
|
|
|
collection = collection.filter((equip) => equip.treeId === this.treeNode.currentId) |
|
|
|
// if (this.treeNode.level === 1) { |
|
|
|
// collection = collection.filter((equip) => equip.prepretreeId === this.treeNode.currentId) |
|
|
|
// } else if (this.treeNode.level === 2) { |
|
|
|
// collection = collection.filter((equip) => equip.pretreeId === this.treeNode.currentId) |
|
|
|
// } else if (this.treeNode.level === 3) { |
|
|
|
// collection = collection.filter((equip) => equip.treeId === this.treeNode.currentId) |
|
|
|
// } |
|
|
|
} else { |
|
|
|
let fileCurrentIdList = [] |
|
|
|
for (let i = 0; i < this.treeData.length; i++) { |
|
|
|
let treeItem = this.treeData[i]; |
|
|
|
fileCurrentIdList.push(treeItem.currentId) |
|
|
|
} |
|
|
|
collection = collection.filter((equip) => fileCurrentIdList.includes(equip.prepretreeId)) |
|
|
|
collection = collection.filter((equip) => equip.treeId === false) |
|
|
|
// let fileCurrentIdList = [] |
|
|
|
// for (let i = 0; i < this.treeData.length; i++) { |
|
|
|
// let treeItem = this.treeData[i]; |
|
|
|
// fileCurrentIdList.push(treeItem.currentId) |
|
|
|
// } |
|
|
|
// collection = collection.filter((equip) => fileCurrentIdList.includes(equip.prepretreeId)) |
|
|
|
} |
|
|
|
if (!_.isEmpty(this.wenjianObj)) { |
|
|
|
let wenjianName = _.trim(this.wenjianObj.wenjianName) |
|
|
@ -626,7 +629,7 @@ export default { |
|
|
|
"一级卷名": _.split(listItem.juanName, "_")[0], |
|
|
|
"二级卷名": _.split(listItem.juanName, "_")[1], |
|
|
|
"文件名": listItem.fileName, |
|
|
|
"文件路径": `D:\\test\\${listItem.path}`, |
|
|
|
"文件路径": `D:\\test\\${listItem.path.replace("D:\\test\\", "")}`, |
|
|
|
"文件类型": _.find(this.fileList, { value: listItem.fileType }).label, |
|
|
|
"文件大小": this.genSize(listItem.size), |
|
|
|
"文件状态": listItem.status, |
|
|
@ -675,7 +678,7 @@ export default { |
|
|
|
}, |
|
|
|
//新增文件 |
|
|
|
async addFile() { |
|
|
|
if (_.get(this.treeNode, 'level') !== 3) { |
|
|
|
if (_.get(this.treeNode, 'level') === 1) { |
|
|
|
ElMessage({ |
|
|
|
message: '请选择项目', |
|
|
|
type: 'warning' |
|
|
@ -945,7 +948,7 @@ export default { |
|
|
|
pretreeId: this.treeNode.preId, |
|
|
|
prepretreeId: this.treeNode.prepreId, |
|
|
|
xiangmuName: filePathList[0], |
|
|
|
juanName: `${filePathList[1]}_${filePathList[2]}`, |
|
|
|
juanName: `${filePathList[1]}${filePathList[2] ? "_" + filePathList[2] : ""}`, |
|
|
|
fileName: fileItem.raw.name, |
|
|
|
fileType: fileItem.raw.type, |
|
|
|
uploadTime: dayjs().format('YYYY-MM-DD HH:mm:ss'), |
|
|
@ -982,6 +985,7 @@ export default { |
|
|
|
update_at: dayjs().format('YYYY-MM-DD HH:mm:ss'), |
|
|
|
} |
|
|
|
await myDatabase.fileList.put({ ...fileItem }) |
|
|
|
window.electron.ipcRenderer.send('createFile', JSON.stringify([{ ...fileItem }])) |
|
|
|
} |
|
|
|
await this.searchTable() |
|
|
|
this.cancelFileDialog() |
|
|
|