|
|
@@ -5,51 +5,29 @@
|
|
|
<hc-card>
|
|
|
<!-- Element Plus 菜单组件 -->
|
|
|
<ElMenu
|
|
|
+ v-loading="folderLoading"
|
|
|
default-active="1-1"
|
|
|
class="custom-menu"
|
|
|
:collapse="isCollapse"
|
|
|
- @open="handleOpen"
|
|
|
- @close="handleClose"
|
|
|
+
|
|
|
@select="handleSelect"
|
|
|
>
|
|
|
- <!-- 给父菜单添加动态激活类 -->
|
|
|
- <ElSubMenu
|
|
|
- index="1"
|
|
|
- :class="{ 'parent-active': isParentActive('1') }"
|
|
|
- >
|
|
|
- <template #title>
|
|
|
- <span :class="{ 'titleparent-active': isParentActive('1') }">主导航</span>
|
|
|
- </template>
|
|
|
- <ElMenuItem index="1-1">首页</ElMenuItem>
|
|
|
- <ElMenuItem index="1-2">数据统计</ElMenuItem>
|
|
|
- <ElMenuItem index="1-3">报表分析</ElMenuItem>
|
|
|
- </ElSubMenu>
|
|
|
- <ElSubMenu
|
|
|
- index="2"
|
|
|
- :class="{ 'parent-active': isParentActive('2') }"
|
|
|
- >
|
|
|
- <template #title>
|
|
|
- <span :class="{ 'titleparent-active': isParentActive('2') }">系统设置</span>
|
|
|
- </template>
|
|
|
- <ElMenuItem index="2-1">用户管理</ElMenuItem>
|
|
|
- <ElMenuItem index="2-2">权限设置</ElMenuItem>
|
|
|
- <ElMenuItem index="2-3">系统配置</ElMenuItem>
|
|
|
- </ElSubMenu>
|
|
|
- <ElMenuItem index="3">
|
|
|
- <span>帮助中心</span>
|
|
|
- </ElMenuItem>
|
|
|
+ <!-- 渲染动态菜单 -->
|
|
|
+ <template v-for="item in folderData" :key="item.id">
|
|
|
+ <MenuItem :menu-item-data="item" :selected-key-path="selectedKeyPath" />
|
|
|
+ </template>
|
|
|
</ElMenu>
|
|
|
</hc-card>
|
|
|
</template>
|
|
|
<hc-new-card>
|
|
|
<template #extra>
|
|
|
- <el-button hc-btn type="danger">开始扫描</el-button>
|
|
|
+ <el-button hc-btn type="danger" :loading="scanLoading" @click="scanClick">开始扫描</el-button>
|
|
|
</template>
|
|
|
<template #header>
|
|
|
<el-button hc-btn color="#12B9A7" class="text-white" @click="movesClick">移动</el-button>
|
|
|
<el-button hc-btn color="#149BF4" class="text-white">自动识别</el-button>
|
|
|
- <el-button hc-btn class="text-white" color="#149BF4">编辑</el-button>
|
|
|
- <el-button hc-btn type="danger">删除</el-button>
|
|
|
+ <el-button hc-btn class="text-white" color="#149BF4" :disabled="!tableCheckedKeys.length" @click="editClick">编辑</el-button>
|
|
|
+ <el-button v-del-com:[delClick] hc-btn type="danger" :disabled="!tableCheckedKeys.length">删除</el-button>
|
|
|
</template>
|
|
|
|
|
|
<HcTable
|
|
|
@@ -58,8 +36,8 @@
|
|
|
:cell-style="tableCellStyle"
|
|
|
@selection-change="tableSelection"
|
|
|
>
|
|
|
- <template #name="{ row }">
|
|
|
- <span class="text-link" @click="viewPdf(row.id)">{{ row?.name }}</span>
|
|
|
+ <template #fileName="{ row }">
|
|
|
+ <span class="text-link" @click="viewPdf(row.ossUrl)">{{ row?.fileName }}</span>
|
|
|
</template>
|
|
|
</HcTable>
|
|
|
<template #action>
|
|
|
@@ -107,36 +85,85 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</hc-new-dialog>
|
|
|
+ <!-- 编辑 -->
|
|
|
+ <hc-new-dialog v-model="editModal" :loading="editLoading" is-table title="编辑" widths="60vw" @close="editModalClose" @save="editModalSave">
|
|
|
+ <HcTable
|
|
|
+ ui="hc-form-table" is-new :is-index="false"
|
|
|
+ :column="tableEditColumn" :datas="tableEditData"
|
|
|
+ >
|
|
|
+ <template #fileNum="{ row }">
|
|
|
+ <el-input v-model="row.fileNum" />
|
|
|
+ </template>
|
|
|
+ <template #fileName="{ row }">
|
|
|
+ <el-input v-model="row.fileName" type="textarea" />
|
|
|
+ </template>
|
|
|
+
|
|
|
+
|
|
|
+ <template #responsible="{ row }">
|
|
|
+ <el-input v-model="row.responsible" type="textarea" />
|
|
|
+ </template>
|
|
|
+ <template #fileDate="{ row }">
|
|
|
+ <el-date-picker v-model="row.fileDate" value-format="YYYY-MM-DD HH:mm:ss" type="datetime" />
|
|
|
+ </template>
|
|
|
+ </HcTable>
|
|
|
+ </hc-new-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref } from 'vue'
|
|
|
-
|
|
|
-// 菜单折叠状态
|
|
|
+import { onMounted, ref } from 'vue'
|
|
|
+import scanApi from '~api/archiveFile/scanning'
|
|
|
+import { useAppStore } from '~src/store'
|
|
|
+import HcTree from '~src/components/tree/hc-tree.vue'
|
|
|
+import { getArrValue } from 'js-fast-way'
|
|
|
+import MenuItem from './MenuItem.vue' // 导入递归组件
|
|
|
+import { toPdfPage } from '~uti/btn-auth'
|
|
|
+const useAppState = useAppStore()
|
|
|
+const contractId = ref(useAppState.getContractId)
|
|
|
+const projectId = ref(useAppState.getProjectId)
|
|
|
+const folderLoading = ref(false)
|
|
|
+onMounted(()=>{
|
|
|
+ getMenuFolderData()
|
|
|
+
|
|
|
+})
|
|
|
+//菜单数据
|
|
|
+const folderData = ref([])
|
|
|
const isCollapse = ref(false)
|
|
|
// 记录当前选中的完整路径
|
|
|
const selectedKeyPath = ref([])
|
|
|
|
|
|
-// 菜单展开/关闭事件处理
|
|
|
-const handleOpen = (key, keyPath) => {
|
|
|
- console.log(key, keyPath)
|
|
|
-}
|
|
|
|
|
|
-const handleClose = (key, keyPath) => {
|
|
|
- console.log(key, keyPath)
|
|
|
-}
|
|
|
|
|
|
+const folderId = ref('') // 当前选中的文件夹ID
|
|
|
// 处理菜单选择事件 - 记录完整路径
|
|
|
const handleSelect = (key, keyPath) => {
|
|
|
selectedKeyPath.value = keyPath
|
|
|
-}
|
|
|
+ folderId.value = key
|
|
|
+ getTableData()
|
|
|
|
|
|
-// 判断父菜单是否应该激活
|
|
|
-const isParentActive = (parentIndex) => {
|
|
|
- return selectedKeyPath.value.includes(parentIndex)
|
|
|
}
|
|
|
+const getMenuFolderData = async ()=>{
|
|
|
+ folderLoading.value = true
|
|
|
+ const { error, code, data } = await scanApi.getScanFolder({
|
|
|
+ ...searchForm.value,
|
|
|
+ projectId: 111,
|
|
|
+ contractId: 123,
|
|
|
+
|
|
|
+ })
|
|
|
+ folderLoading.value = false
|
|
|
+ if (!error && code === 200) {
|
|
|
+ folderData.value = getArrValue(data)
|
|
|
+
|
|
|
+ } else {
|
|
|
+ folderData.value = []
|
|
|
|
|
|
+ }
|
|
|
+}
|
|
|
+//分页被点击
|
|
|
+const pageChange = ({ current, size }) => {
|
|
|
+ searchForm.value.current = current
|
|
|
+ searchForm.value.size = size
|
|
|
+}
|
|
|
//搜索表单
|
|
|
const searchForm = ref({
|
|
|
contractId: null, type: null, approval: null, betweenTime: null,
|
|
|
@@ -145,26 +172,18 @@ const searchForm = ref({
|
|
|
//表格数据
|
|
|
const tableRef = ref(null)
|
|
|
const tableColumn = ref([
|
|
|
- { key: 'fileNumber', name: '数字编号' },
|
|
|
- { key: 'name', name: '文件编号' },
|
|
|
- { key: 'storageTimeValue', name: '文件题名' },
|
|
|
- { key: 'pageN', name: '文件页数' },
|
|
|
- { key: 'pageN', name: '文件日期' },
|
|
|
- { key: 'pageN', name: '责任者' },
|
|
|
+ { key: 'digitalNum', name: '数字编号' },
|
|
|
+ { key: 'fileNum', name: '文件编号' },
|
|
|
+ { key: 'fileName', name: '文件题名' },
|
|
|
+ { key: 'fileSize', name: '文件页数' },
|
|
|
+ { key: 'fileDate', name: '文件日期' },
|
|
|
+ { key: 'responsible', name: '责任者' },
|
|
|
|
|
|
])
|
|
|
-const tableData = ref([
|
|
|
- { id: 1, fileNumber: '001', name: '合同文件-2023-001', storageTimeValue: '合同文件', pageN: 10 },
|
|
|
- { id: 2, fileNumber: '002', name: '项目计划-2023-002', storageTimeValue: '项目计划', pageN: 15 },
|
|
|
- { id: 3, fileNumber: '003', name: '预算报告-2023-003', storageTimeValue: '预算报告', pageN: 8 },
|
|
|
- { id: 4, fileNumber: '004', name: '会议纪要-2023-004', storageTimeValue: '会议纪要', pageN: 12 },
|
|
|
- { id: 5, fileNumber: '005', name: '技术文档-2023-005', storageTimeValue: '技术文档', pageN: 20 },
|
|
|
- { id: 6, fileNumber: '006', name: '市场分析-2023-006', storageTimeValue: '市场分析', pageN: 18 },
|
|
|
- { id: 7, fileNumber: '007', name: '用户反馈-2023-007', storageTimeValue: '用户反馈', pageN: 5 },
|
|
|
- { id: 8, fileNumber: '008', name: '产品规格-2023-008', storageTimeValue: '产品规格', pageN: 22 },
|
|
|
- { id: 9, fileNumber: '009', name: '销售报告-2023-009', storageTimeValue: '销售报告', pageN: 14 },
|
|
|
- { id: 10, fileNumber: '010', name: '年度总结-2023-010', storageTimeValue: '年度总结', pageN: 30 },
|
|
|
-])
|
|
|
+const tableData = ref([ ])
|
|
|
+const viewPdf = (ossUrl)=>{
|
|
|
+ toPdfPage(ossUrl)
|
|
|
+}
|
|
|
//设置单元格的样式
|
|
|
const tableCellStyle = ({ row, column, rowIndex, columnIndex }) => {
|
|
|
if (row.id === 1 && column.property === 'name') {
|
|
|
@@ -178,11 +197,11 @@ const tableCellStyle = ({ row, column, rowIndex, columnIndex }) => {
|
|
|
const tableLoading = ref(false)
|
|
|
const getTableData = async () => {
|
|
|
tableLoading.value = true
|
|
|
- const { error, code, data } = await tuningApi.pageByArchive({
|
|
|
+ const { error, code, data } = await scanApi.getScanFile({
|
|
|
...searchForm.value,
|
|
|
- projectId: projectId.value,
|
|
|
- contractId: contractId.value,
|
|
|
- isArchive: 1,
|
|
|
+ projectId: 111,
|
|
|
+ contractId: 123,
|
|
|
+ folderId: folderId.value,
|
|
|
})
|
|
|
tableLoading.value = false
|
|
|
if (!error && code === 200) {
|
|
|
@@ -256,72 +275,82 @@ const movesModalSave = async () => {
|
|
|
const movesModalClose = () => {
|
|
|
movesModal.value = false
|
|
|
}
|
|
|
-</script>
|
|
|
-
|
|
|
-<style scoped lang="scss">
|
|
|
-/* 基础菜单样式 */
|
|
|
-.custom-menu {
|
|
|
- width: 100%;
|
|
|
- min-height: 400px;
|
|
|
- border-right: none !important;
|
|
|
-}
|
|
|
-
|
|
|
-/* 菜单项基础样式 */
|
|
|
-.custom-menu .el-menu-item,
|
|
|
-.custom-menu .el-sub-menu__title {
|
|
|
- position: relative;
|
|
|
- transition: all 0.3s ease;
|
|
|
-}
|
|
|
-
|
|
|
-/* 选中菜单项样式 */
|
|
|
-.custom-menu .el-menu-item.is-active {
|
|
|
- color: #149BF4 !important;
|
|
|
- background-color: #E6F7FF !important;
|
|
|
-}
|
|
|
|
|
|
-/* 选中菜单项右侧边框 */
|
|
|
-.custom-menu .el-menu-item.is-active::after {
|
|
|
- content: '';
|
|
|
- position: absolute;
|
|
|
- right: 0;
|
|
|
- top: 0;
|
|
|
- height: 100%;
|
|
|
- width: 6px;
|
|
|
- background-color: #149BF4;
|
|
|
+//开始扫描
|
|
|
+const scanLoading = ref(false)
|
|
|
+const scanClick = async () => {
|
|
|
+ scanLoading.value = true
|
|
|
+ const { error, code, data, msg } = await scanApi.startOrEndScan({
|
|
|
+ type: 1,
|
|
|
+ contractId: contractId.value,
|
|
|
+ })
|
|
|
+ scanLoading.value = false
|
|
|
+ if (!error && code === 200) {
|
|
|
+ window.$message?.success(msg)
|
|
|
+ getTableData()
|
|
|
+ } else {
|
|
|
+ window.$message?.warning(msg)
|
|
|
+ }
|
|
|
+ movesModal.value = false
|
|
|
}
|
|
|
-
|
|
|
-/* 父菜单标题激活样式 */
|
|
|
-.titleparent-active {
|
|
|
- color: #149BF4 !important;
|
|
|
- font-weight: bold !important;
|
|
|
+//编辑
|
|
|
+const editModal = ref(false)
|
|
|
+const editClick = () => {
|
|
|
+ editModal.value = true
|
|
|
+ tableEditData.value = JSON.parse(JSON.stringify(tableCheckedKeys.value))
|
|
|
}
|
|
|
-
|
|
|
-/* 父菜单激活时箭头变色 - 通过父级激活类控制 */
|
|
|
-.parent-active .el-sub-menu__icon-arrow {
|
|
|
- color: #149BF4 !important;
|
|
|
+const editLoading = ref(false)
|
|
|
+const editModalSave = async () => {
|
|
|
+ editLoading.value = true
|
|
|
+ const { error, code } = await scanApi.updateScanFile({
|
|
|
+ list: tableEditData.value,
|
|
|
+ }, false)
|
|
|
+ //判断状态
|
|
|
+ editLoading.value = false
|
|
|
+ if (!error && code === 200) {
|
|
|
+ window.$message?.success('保存成功')
|
|
|
+ editModalClose()
|
|
|
+ getTableData()
|
|
|
+ } else {
|
|
|
+ window.$message?.error('保存失败')
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
-/* 解决scoped样式穿透问题 */
|
|
|
-:deep(.parent-active) .el-sub-menu__icon-arrow {
|
|
|
- color: #149BF4 !important;
|
|
|
+const editModalClose = () => {
|
|
|
+ editModal.value = false
|
|
|
+ tableRef.value?.clearSelection()
|
|
|
}
|
|
|
+const tableEditColumn = ref([
|
|
|
|
|
|
-/* 方
|
|
|
-/* 二级菜单背景色 - 保持f7f7f7 */
|
|
|
-.custom-menu .el-sub-menu .el-menu {
|
|
|
- background-color: #F7F7F7 !important;
|
|
|
-}
|
|
|
+ { key: 'fileNum', name: '文件编号' },
|
|
|
+ { key: 'fileName', name: '文件题名' },
|
|
|
+ { key: 'fileDate', name: '文件日期' },
|
|
|
+ { key: 'responsible', name: '责任者' },
|
|
|
+])
|
|
|
+const tableEditData = ref([])
|
|
|
|
|
|
-/* 二级菜单项默认样式 */
|
|
|
-.custom-menu .el-sub-menu .el-menu .el-menu-item {
|
|
|
- background-color: #F7F7F7 !important;
|
|
|
+const delClick = async (_, resolve) => {
|
|
|
+ let ids = []
|
|
|
+ tableCheckedKeys.value.forEach((element)=>{
|
|
|
+ ids.push(element.id)
|
|
|
+ })
|
|
|
+ const { error, code } = await scanApi.deleteScanFile({
|
|
|
+ ids: ids.join(','),
|
|
|
+ })
|
|
|
+ //处理数据
|
|
|
+ if (!error && code === 200) {
|
|
|
+ window.$message?.success('操作成功')
|
|
|
+ getTableData()
|
|
|
+ }
|
|
|
+ resolve()
|
|
|
}
|
|
|
+</script>
|
|
|
|
|
|
-/* 二级菜单项选中样式 */
|
|
|
-.custom-menu .el-sub-menu .el-menu .el-menu-item.is-active {
|
|
|
- background-color: #E6F7FF !important;
|
|
|
+<style scoped lang="scss">
|
|
|
+.custom-menu {
|
|
|
+ width: 100%;
|
|
|
+ min-height: 400px;
|
|
|
+ border-right: none !important;
|
|
|
}
|
|
|
-
|
|
|
.hc-card {
|
|
|
position: relative;
|
|
|
}
|