|
@ -1,11 +1,12 @@ |
|
|
<template> |
|
|
<template> |
|
|
<div class="rightClass"> |
|
|
<div class="rightClass"> |
|
|
|
|
|
<h1 style="text-align: center;font-weight: 500;">海丰县不可移动文物四有资料管理系统</h1> |
|
|
<div style="margin: 0 0 8px 8px;"> |
|
|
<div style="margin: 0 0 8px 8px;"> |
|
|
<el-row :gutter="20"> |
|
|
<el-row :gutter="20"> |
|
|
<el-col> |
|
|
<el-col> |
|
|
<div style="width: calc(100vw - 400px);display: inline-block;margin-right: 12px;"> |
|
|
<div style="width: calc(100vw - 400px);display: inline-block;margin-right: 12px;"> |
|
|
<el-input v-model="xiangmuObj.xianmguName" placeholder="请输入项目名" clearable> |
|
|
<el-input v-model="xiangmuObj.xianmguName" placeholder="请输入" clearable> |
|
|
<template #prepend>项目名:</template> |
|
|
<template #prepend>项目名</template> |
|
|
</el-input> |
|
|
</el-input> |
|
|
</div> |
|
|
</div> |
|
|
<el-button type="primary" @click="clearAndSearchTree"> |
|
|
<el-button type="primary" @click="clearAndSearchTree"> |
|
@ -49,7 +50,7 @@ |
|
|
<el-form-item label="状态:"> |
|
|
<el-form-item label="状态:"> |
|
|
<el-radio-group v-model="wenjianObj.status" style="display: inline-block;"> |
|
|
<el-radio-group v-model="wenjianObj.status" style="display: inline-block;"> |
|
|
<el-radio-button :label="statusItem.label" :value="statusItem.value" |
|
|
<el-radio-button :label="statusItem.label" :value="statusItem.value" |
|
|
v-for="(statusItem, statusIndex) in statusList" :key="statusIndex" :class="`${statusItem.class}`"> |
|
|
v-for="(statusItem, statusIndex) in statusList" :key="statusIndex"> |
|
|
</el-radio-button> |
|
|
</el-radio-button> |
|
|
</el-radio-group> |
|
|
</el-radio-group> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
@ -59,7 +60,7 @@ |
|
|
</div> |
|
|
</div> |
|
|
<div style="margin-bottom: 8px;"> |
|
|
<div style="margin-bottom: 8px;"> |
|
|
<el-row :gutter="20"> |
|
|
<el-row :gutter="20"> |
|
|
<el-col :span="4"> |
|
|
<el-col :span="3"> |
|
|
<!-- <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-button type="primary" plain @click="addFile" :disabled="[1].includes(_.get(treeNode, 'level', 1))"> |
|
|
<el-icon> |
|
|
<el-icon> |
|
@ -73,7 +74,7 @@ |
|
|
<template #prepend>文件名:</template> |
|
|
<template #prepend>文件名:</template> |
|
|
</el-input> |
|
|
</el-input> |
|
|
</el-col> |
|
|
</el-col> |
|
|
<el-col :span="9" style="position: relative;top:-3px;"> |
|
|
<el-col :span="10" style="position: relative;top:-3px;"> |
|
|
<el-button type="primary" @click="searchTable"> |
|
|
<el-button type="primary" @click="searchTable"> |
|
|
<el-icon> |
|
|
<el-icon> |
|
|
<Search /> |
|
|
<Search /> |
|
@ -86,6 +87,12 @@ |
|
|
</el-icon> |
|
|
</el-icon> |
|
|
<span>重置</span> |
|
|
<span>重置</span> |
|
|
</el-button> |
|
|
</el-button> |
|
|
|
|
|
<el-button @click="clearAll" type="danger"> |
|
|
|
|
|
<el-icon> |
|
|
|
|
|
<Delete /> |
|
|
|
|
|
</el-icon> |
|
|
|
|
|
<span>清空</span> |
|
|
|
|
|
</el-button> |
|
|
<div class="inputClass uploadClass"> |
|
|
<div class="inputClass uploadClass"> |
|
|
<el-upload :show-file-list="false" v-model="fileOriData" :before-upload="beforeAvatarUpload" |
|
|
<el-upload :show-file-list="false" v-model="fileOriData" :before-upload="beforeAvatarUpload" |
|
|
:http-request="successSubmit" accept=".xls,.xlsx,.csv"> |
|
|
:http-request="successSubmit" accept=".xls,.xlsx,.csv"> |
|
@ -93,7 +100,7 @@ |
|
|
<el-icon> |
|
|
<el-icon> |
|
|
<Upload /> |
|
|
<Upload /> |
|
|
</el-icon> |
|
|
</el-icon> |
|
|
<span>导入历史数据</span> |
|
|
<span>导入数据</span> |
|
|
</el-button> |
|
|
</el-button> |
|
|
</el-upload> |
|
|
</el-upload> |
|
|
</div> |
|
|
</div> |
|
@ -170,7 +177,7 @@ export default { |
|
|
wenjianObj: { |
|
|
wenjianObj: { |
|
|
wenjianName: "", |
|
|
wenjianName: "", |
|
|
fileType: "", |
|
|
fileType: "", |
|
|
status: "", |
|
|
status: "正常", |
|
|
}, |
|
|
}, |
|
|
fileList: [ |
|
|
fileList: [ |
|
|
{ |
|
|
{ |
|
@ -214,19 +221,16 @@ export default { |
|
|
{ |
|
|
{ |
|
|
label: "全部", |
|
|
label: "全部", |
|
|
color: "#409eff", |
|
|
color: "#409eff", |
|
|
class: "allClass", |
|
|
|
|
|
value: "", |
|
|
value: "", |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
label: "正常", |
|
|
label: "正常", |
|
|
color: "#67c23a", |
|
|
color: "#67c23a", |
|
|
class: "normalClass", |
|
|
|
|
|
value: "正常" |
|
|
value: "正常" |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
label: "已注销", |
|
|
label: "已注销", |
|
|
color: "#f56c6c", |
|
|
color: "#f56c6c", |
|
|
class: "unregisterClass", |
|
|
|
|
|
value: "已注销" |
|
|
value: "已注销" |
|
|
}, |
|
|
}, |
|
|
], |
|
|
], |
|
@ -300,16 +304,15 @@ export default { |
|
|
let workbook = XLSX.read(data, { type: 'binary' }) |
|
|
let workbook = XLSX.read(data, { type: 'binary' }) |
|
|
let sheetName = workbook.SheetNames[0] |
|
|
let sheetName = workbook.SheetNames[0] |
|
|
let sheetData = XLSX.utils.sheet_to_json(workbook.Sheets[sheetName]) |
|
|
let sheetData = XLSX.utils.sheet_to_json(workbook.Sheets[sheetName]) |
|
|
let xiangmuObj = _.groupBy(sheetData, "项目名") |
|
|
let xiangmuObj = _.groupBy(_.cloneDeep(sheetData), "项目名") |
|
|
let excludeList = ["123123", "test2222", "主卷"] |
|
|
|
|
|
let xiangmuList = [] |
|
|
let xiangmuList = [] |
|
|
for (let key in xiangmuObj) { |
|
|
for (let key in xiangmuObj) { |
|
|
if (key && !excludeList.includes(key)) { |
|
|
if (key) { |
|
|
xiangmuList.push(key) |
|
|
xiangmuList.push(key) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
let { pathList, treeList } = that.bulkAddXiangmu(xiangmuList) |
|
|
let { pathList, treeList } = that.bulkAddXiangmu(xiangmuList) |
|
|
let { tableList, successList } = that.bulkAddFile(treeList, sheetData) |
|
|
let { tableList } = that.bulkAddFile(treeList, sheetData) |
|
|
that.inputTreeList = _.cloneDeep(treeList) |
|
|
that.inputTreeList = _.cloneDeep(treeList) |
|
|
that.inputTableList = _.cloneDeep(tableList) |
|
|
that.inputTableList = _.cloneDeep(tableList) |
|
|
that.inputPathList = _.cloneDeep(pathList) |
|
|
that.inputPathList = _.cloneDeep(pathList) |
|
@ -380,8 +383,8 @@ export default { |
|
|
|
|
|
|
|
|
// 批量新增文件 |
|
|
// 批量新增文件 |
|
|
bulkAddFile(treeList, tableDataList) { |
|
|
bulkAddFile(treeList, tableDataList) { |
|
|
|
|
|
console.log(386, tableDataList); |
|
|
let tableList = [] |
|
|
let tableList = [] |
|
|
let successList = [] |
|
|
|
|
|
for (let i = 0; i < tableDataList.length; i++) { |
|
|
for (let i = 0; i < tableDataList.length; i++) { |
|
|
let fileItem = tableDataList[i]; |
|
|
let fileItem = tableDataList[i]; |
|
|
let juanNameLIst = _.split(fileItem["文件名"], "·") |
|
|
let juanNameLIst = _.split(fileItem["文件名"], "·") |
|
@ -391,11 +394,12 @@ export default { |
|
|
let chineseCharsOnly = pdfText.match(/[\u4e00-\u9fa5]+/g); |
|
|
let chineseCharsOnly = pdfText.match(/[\u4e00-\u9fa5]+/g); |
|
|
let juanName = chineseCharsOnly ? chineseCharsOnly.join('') : ''; |
|
|
let juanName = chineseCharsOnly ? chineseCharsOnly.join('') : ''; |
|
|
let treeItem = _.find(treeList, o => o.path === `${fileItem["项目名"]}\\${fileItem["卷名"]}\\${juanName}`) |
|
|
let treeItem = _.find(treeList, o => o.path === `${fileItem["项目名"]}\\${fileItem["卷名"]}\\${juanName}`) |
|
|
|
|
|
let treeItem1 = _.find(treeList, o => _.startsWith(o.path, `${fileItem["项目名"]}\\${fileItem["卷名"]}`) && juanName.includes(o.label)) |
|
|
|
|
|
let treeItem2 = _.find(treeList, o => _.startsWith(o.path, `${fileItem["项目名"]}}`) && juanName.includes(o.label)) |
|
|
let path = _.split(fileItem["储存位置"], "_") |
|
|
let path = _.split(fileItem["储存位置"], "_") |
|
|
let fileType = _.find(this.fileList, o => o.label === path[1].split(".")[1]) |
|
|
let fileType = _.find(this.fileList, o => o.label === path[1].split(".")[1]) |
|
|
let prepath = _.split(fileItem["储存位置"], "uploadPath/") |
|
|
let prepath = _.split(fileItem["储存位置"], "uploadPath/") |
|
|
if (treeItem) { |
|
|
if (treeItem) { |
|
|
successList.push(i) |
|
|
|
|
|
tableList.push({ |
|
|
tableList.push({ |
|
|
treeId: treeItem.currentId, |
|
|
treeId: treeItem.currentId, |
|
|
pretreeId: treeItem.preId, |
|
|
pretreeId: treeItem.preId, |
|
@ -413,10 +417,46 @@ export default { |
|
|
create_at: dayjs().format('YYYY-MM-DD HH:mm:ss'), |
|
|
create_at: dayjs().format('YYYY-MM-DD HH:mm:ss'), |
|
|
update_at: dayjs().format('YYYY-MM-DD HH:mm:ss'), |
|
|
update_at: dayjs().format('YYYY-MM-DD HH:mm:ss'), |
|
|
}) |
|
|
}) |
|
|
|
|
|
} else if (treeItem1) { |
|
|
|
|
|
tableList.push({ |
|
|
|
|
|
treeId: treeItem1.currentId, |
|
|
|
|
|
pretreeId: treeItem1.preId, |
|
|
|
|
|
prepretreeId: treeItem1.prepreId, |
|
|
|
|
|
xiangmuName: fileItem["项目名"], |
|
|
|
|
|
juanName: `${fileItem["卷名"]}`, |
|
|
|
|
|
fileName: path[1], |
|
|
|
|
|
fileType: (fileType || {}).value, |
|
|
|
|
|
uploadTime: fileItem["上传时间"], |
|
|
|
|
|
status: fileItem["状态"], |
|
|
|
|
|
size: "", |
|
|
|
|
|
path: `D: \\test\\${fileItem["项目名"]}\\${fileItem["卷名"]}\\${path[1]}`, |
|
|
|
|
|
prePath: `D: \\uploadPath\\${prepath[1].replaceAll("/", "\\")}`, |
|
|
|
|
|
note: fileItem["备注"], |
|
|
|
|
|
create_at: dayjs().format('YYYY-MM-DD HH:mm:ss'), |
|
|
|
|
|
update_at: dayjs().format('YYYY-MM-DD HH:mm:ss'), |
|
|
|
|
|
}) |
|
|
|
|
|
} else if (treeItem2) { |
|
|
|
|
|
tableList.push({ |
|
|
|
|
|
treeId: treeItem2.currentId, |
|
|
|
|
|
pretreeId: treeItem2.preId, |
|
|
|
|
|
prepretreeId: treeItem2.prepreId, |
|
|
|
|
|
xiangmuName: fileItem["项目名"], |
|
|
|
|
|
juanName: `${fileItem["卷名"]}_${juanName}`, |
|
|
|
|
|
fileName: path[1], |
|
|
|
|
|
fileType: (fileType || {}).value, |
|
|
|
|
|
uploadTime: fileItem["上传时间"], |
|
|
|
|
|
status: fileItem["状态"], |
|
|
|
|
|
size: "", |
|
|
|
|
|
path: `D: \\test\\${fileItem["项目名"]}\\${path[1]}`, |
|
|
|
|
|
prePath: `D: \\uploadPath\\${prepath[1].replaceAll("/", "\\")}`, |
|
|
|
|
|
note: fileItem["备注"], |
|
|
|
|
|
create_at: dayjs().format('YYYY-MM-DD HH:mm:ss'), |
|
|
|
|
|
update_at: dayjs().format('YYYY-MM-DD HH:mm:ss'), |
|
|
|
|
|
}) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
return { tableList, successList } |
|
|
return { tableList } |
|
|
}, |
|
|
}, |
|
|
// inputData |
|
|
// inputData |
|
|
async inputData(treeList, pathList, tableList) { |
|
|
async inputData(treeList, pathList, tableList) { |
|
@ -483,7 +523,8 @@ export default { |
|
|
check: false, |
|
|
check: false, |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
this.treeData = treeList |
|
|
|
|
|
|
|
|
this.treeData = _.sortBy(treeList, "label") |
|
|
await this.searchTable() |
|
|
await this.searchTable() |
|
|
}, |
|
|
}, |
|
|
//搜索数据(表格) |
|
|
//搜索数据(表格) |
|
@ -713,6 +754,41 @@ export default { |
|
|
this.treeNode = {} |
|
|
this.treeNode = {} |
|
|
await this.searchTable() |
|
|
await this.searchTable() |
|
|
}, |
|
|
}, |
|
|
|
|
|
//清空 |
|
|
|
|
|
async clearAll() { |
|
|
|
|
|
ElMessageBox.confirm( |
|
|
|
|
|
'是否删除所有的护具,此操作不可逆,请谨慎操作!!!', |
|
|
|
|
|
'警告', |
|
|
|
|
|
{ |
|
|
|
|
|
confirmButtonText: '确认删除', |
|
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
|
type: 'error', |
|
|
|
|
|
} |
|
|
|
|
|
) |
|
|
|
|
|
.then(async () => { |
|
|
|
|
|
// 清空数据库 |
|
|
|
|
|
let db = await myDatabase.open(); |
|
|
|
|
|
// 获取所有表(对象存储)名称 |
|
|
|
|
|
let tableNames = db._storeNames |
|
|
|
|
|
// 遍历并删除每个表及其数据 |
|
|
|
|
|
for (let index = 0; index < tableNames.length; index++) { |
|
|
|
|
|
let tableName = tableNames[index]; |
|
|
|
|
|
await myDatabase[tableName].clear(); |
|
|
|
|
|
} |
|
|
|
|
|
await this.searchTree() |
|
|
|
|
|
ElMessage({ |
|
|
|
|
|
type: 'error', |
|
|
|
|
|
message: '您已经删除数据库,数据全部清空了!!!', |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
.catch(() => { |
|
|
|
|
|
ElMessage({ |
|
|
|
|
|
type: 'success', |
|
|
|
|
|
message: '您取消删除数据库,数据仍然存在', |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
//预览 |
|
|
//预览 |
|
|
async viewFile(row) { |
|
|
async viewFile(row) { |
|
|
// 根据路径打开文件 |
|
|
// 根据路径打开文件 |
|
|