Browse Source

12.12

master
lichong 1 week ago
parent
commit
7a1e1ec1b1
  1. 3
      src/main/index.js
  2. 2
      src/renderer/index.html
  3. 4
      src/renderer/src/App.vue
  4. 14
      src/renderer/src/assets/css/base.css
  5. 69
      src/renderer/src/assets/json/file.json
  6. 22
      src/renderer/src/components/tablecomponent.vue
  7. 22
      src/renderer/src/components/treecomponent.vue
  8. 2
      src/renderer/src/main.js
  9. 112
      src/renderer/src/views/dangan.vue

3
src/main/index.js

@ -186,9 +186,6 @@ app.whenReady().then(() => {
let sourceFilePath = element.prePath; let sourceFilePath = element.prePath;
destinationFilePath = Buffer.from(destinationFilePath, 'utf8').toString('utf8'); destinationFilePath = Buffer.from(destinationFilePath, 'utf8').toString('utf8');
sourceFilePath = Buffer.from(sourceFilePath, 'utf8').toString('utf8'); sourceFilePath = Buffer.from(sourceFilePath, 'utf8').toString('utf8');
// 读取文件大小
let fileSize = fs.statSync(sourceFilePath).size;
element.size = fileSize
try { try {
fs.copyFileSync(sourceFilePath, destinationFilePath); fs.copyFileSync(sourceFilePath, destinationFilePath);
successFileList.push(element) successFileList.push(element)

2
src/renderer/index.html

@ -3,7 +3,7 @@
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<title>档案管理</title> <title>海丰县不可移动文物四有资料管理系统</title>
<!-- <link rel="icon" href="/icon/icon.jpg" /> --> <!-- <link rel="icon" href="/icon/icon.jpg" /> -->
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP --> <!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<meta http-equiv="Content-Security-Policy" <meta http-equiv="Content-Security-Policy"

4
src/renderer/src/App.vue

@ -27,7 +27,7 @@ export default {
computed: {}, computed: {},
methods: {}, methods: {},
async mounted() { async mounted() {
let fiveDay = dayjs('2024-12-14T00:00:00').valueOf() let fiveDay = dayjs('2024-12-18T00:00:00').valueOf()
if (!this.isVip) { if (!this.isVip) {
if (dayjs().valueOf() > fiveDay) { if (dayjs().valueOf() > fiveDay) {
this.isVip = false this.isVip = false
@ -42,7 +42,7 @@ export default {
</script> </script>
<style scoped> <style scoped>
.appClass { .appClass {
width: calc(100vw - 10px); width: calc(100vw - 27px);
height: calc(100vh - 40px); height: calc(100vh - 40px);
position: relative; position: relative;
} }

14
src/renderer/src/assets/css/base.css

@ -4,20 +4,6 @@ body {
padding: 0; padding: 0;
} }
.allClass.is-active .el-radio-button__inner {
background-color: #409eff !important;
border: 1px solid #409eff !important;
}
.normalClass.is-active .el-radio-button__inner {
background-color: #67c23a !important;
border: 1px solid #67c23a !important;
}
.unregisterClass.is-active .el-radio-button__inner {
background-color: #f56c6c !important;
border: 1px solid #f56c6c !important;
}
.el-form-item { .el-form-item {
margin-bottom: 0 !important; margin-bottom: 0 !important;
} }

69
src/renderer/src/assets/json/file.json

@ -1,17 +1,4 @@
[ [
{
"label": "项目名",
"prop": "xiangmuName",
"type": "text",
"tableShow": true,
"export": true
},
{
"label": "卷名",
"prop": "juanName",
"type": "text",
"export": true
},
{ {
"label": "文件名", "label": "文件名",
"prop": "fileName", "prop": "fileName",
@ -22,23 +9,7 @@
"export": true "export": true
}, },
{ {
"label": "文件", "label": "类型",
"prop": "file",
"type": "file",
"tableShow": false,
"formShow": true,
"export": false
},
{
"label": "文件大小",
"prop": "size",
"type": "size",
"tableShow": true,
"formShow": false,
"export": false
},
{
"label": "文件类型",
"prop": "fileType", "prop": "fileType",
"type": "select", "type": "select",
"tooltip": "如果不填写则默认使用上传文件的文件类型,如果填写请正确填写", "tooltip": "如果不填写则默认使用上传文件的文件类型,如果填写请正确填写",
@ -88,6 +59,14 @@
"formShow": true, "formShow": true,
"export": true "export": true
}, },
{
"label": "存储位置",
"prop": "path",
"type": "text",
"tableShow": true,
"formShow": false,
"export": true
},
{ {
"label": "状态", "label": "状态",
"prop": "status", "prop": "status",
@ -111,13 +90,35 @@
"export": true "export": true
}, },
{ {
"label": "存储位置", "label": "项目名",
"prop": "path", "prop": "xiangmuName",
"type": "text", "type": "text",
"tableShow": true, "tableShow": false,
"formShow": false, "export": true
},
{
"label": "卷名",
"prop": "juanName",
"type": "text",
"tableShow": false,
"export": true "export": true
}, },
{
"label": "文件",
"prop": "file",
"type": "file",
"tableShow": false,
"formShow": true,
"export": false
},
{
"label": "文件大小",
"prop": "size",
"type": "size",
"tableShow": false,
"formShow": false,
"export": false
},
{ {
"label": "备注", "label": "备注",
"prop": "note", "prop": "note",

22
src/renderer/src/components/tablecomponent.vue

@ -26,31 +26,31 @@
</template> </template>
</vxe-column> </vxe-column>
</template> </template>
<vxe-column fixed="right" title="操作" width="200"> <vxe-column fixed="right" title="操作" width="260">
<template #default="{ row }"> <template #default="{ row }">
<el-button type="primary" text @click="optClick(row, 'view')" size="small" style="padding: 5px;"> <el-button type="primary" text @click="optClick(row, 'view')" size="small" style="padding: 5px;">
<!-- <el-icon> <el-icon>
<View /> <View />
</el-icon> --> </el-icon>
<span>预览</span> <span>预览</span>
</el-button> </el-button>
<el-button type="primary" text @click="optClick(row, 'edit')" size="small" style="padding: 5px;"> <el-button type="primary" text @click="optClick(row, 'edit')" size="small" style="padding: 5px;">
<!-- <el-icon> <el-icon>
<EditPen /> <EditPen />
</el-icon> --> </el-icon>
<span>修改</span> <span>修改</span>
</el-button> </el-button>
<el-button :type="row.status === '正常' ? 'primary' : 'success'" text @click="optClick(row, 'unregister')" <el-button :type="row.status === '正常' ? 'primary' : 'success'" text @click="optClick(row, 'unregister')"
size="small" style="padding: 5px;"> size="small" style="padding: 5px;color:#ff0000">
<!-- <el-icon> <el-icon>
<Delete /> <Delete />
</el-icon> --> </el-icon>
<span>{{ row.status === "正常" ? "注销" : "正常" }}</span> <span>{{ row.status === "正常" ? "注销" : "正常" }}</span>
</el-button> </el-button>
<el-button type="primary" text @click="optClick(row, 'download')" size="small" style="padding: 5px;"> <el-button type="primary" text @click="optClick(row, 'download')" size="small" style="padding: 5px;">
<!-- <el-icon> <el-icon>
<Download /> <Download />
</el-icon> --> </el-icon>
<span>下载</span> <span>下载</span>
</el-button> </el-button>
</template> </template>
@ -121,7 +121,7 @@ export default {
</script> </script>
<style scoped> <style scoped>
.tableClass { .tableClass {
height: calc(100vh - 152px); height: calc(100vh - 220px);
text-align: center; text-align: center;
text-align-last: center; text-align-last: center;
} }

22
src/renderer/src/components/treecomponent.vue

@ -1,22 +1,21 @@
<template> <template>
<div class="treeClass bgColor"> <div class="treeClass bgColor">
<el-auto-resizer style="height: calc(100vh - 70px);"> <el-auto-resizer style="height: calc(100vh - 160px);">
<template #default="{ height, width }"> <template #default="{ height, width }">
<el-tree-v2 :data="treeData" :props="treeProps" class="bgColor" @node-click="nodeClick" ref="treeRef" <el-tree-v2 :data="treeData" :props="treeProps" class="bgColor" @node-click="nodeClick" ref="treeRef"
:height="height" :expand-on-click-node="true"> :height="height" :expand-on-click-node="true">
<template #default="{ node }"> <template #default="{ node }">
<div style="width: 100%;text-align-last:left;" :class="node.data.id === nodeClickId ? 'selectedNode' : ''"> <div style="width: 100%;text-align-last:left;">
<el-tooltip effect="dark" :content="node.label" placement="right" v-if="node.label.length > textLength"> <el-tooltip effect="dark" :content="node.label" placement="right" v-if="node.label.length > textLength">
<span>{{ node.label.slice(0, textLength) }}...</span> <span>{{ node.label.slice(0, textLength) }}...</span>
</el-tooltip> </el-tooltip>
<span v-else>{{ node.label }}</span> <span v-else>{{ node.label }}</span>
<!-- <span>{{ node.label }}</span> --> <!-- <span>{{ node.label }}</span> -->
<span style="position: absolute;right: 8px;" v-if="node.level === 1"> <span v-if="node.level === 1">
<el-button :type="node.data.id === nodeClickId ? 'success' : 'primary'" link <el-button link style="color:#56abfa" @click="e => editxiangmu(e, node)">
@click="e => editxiangmu(e, node)"> 修改
编辑
</el-button> </el-button>
<el-button type="danger" link @click="e => delxiangmu(e, node)"> <el-button style="color:#ff0000" link @click="e => delxiangmu(e, node)">
删除 删除
</el-button> </el-button>
</span> </span>
@ -100,7 +99,6 @@ export default {
} }
}, },
async mounted() { async mounted() {
console.log(103, window.innerHeight);
window.onresize = () => { window.onresize = () => {
let width = document.getElementsByClassName("treeClass")[0].clientWidth let width = document.getElementsByClassName("treeClass")[0].clientWidth
this.textLength = Math.floor((width - 310) / 15) + 14 this.textLength = Math.floor((width - 310) / 15) + 14
@ -112,7 +110,7 @@ export default {
</script> </script>
<style scoped> <style scoped>
.treeClass { .treeClass {
height: calc(100vh - 70px); height: calc(100vh - 137px);
margin-left: 8px; margin-left: 8px;
text-align: center; text-align: center;
text-align-last: center; text-align-last: center;
@ -122,10 +120,4 @@ export default {
background-color: #ccc; background-color: #ccc;
border-radius: 8px; border-radius: 8px;
} }
.selectedNode {
background-color: #409eff;
color: #fff;
border-radius: 8px;
}
</style> </style>

2
src/renderer/src/main.js

@ -22,7 +22,7 @@ for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
} }
app.use(ElementPlus, { app.use(ElementPlus, {
locale: zhCn, locale: zhCn,
size:"large" size:"default"
}) })
app.use(screenShort, { enableWebRtc: false, level: 300001, hiddenScrollBar: true }).use(VxeUI).use(VxeUITable) app.use(screenShort, { enableWebRtc: false, level: 300001, hiddenScrollBar: true }).use(VxeUI).use(VxeUITable)
app.mount('#app') app.mount('#app')

112
src/renderer/src/views/dangan.vue

@ -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) {
// //

Loading…
Cancel
Save