From c487278833b62acc3ea88924a39b6238404dc96b Mon Sep 17 00:00:00 2001
From: lion <120344285@qq.com>
Date: Mon, 25 Nov 2024 14:46:31 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/layout/components/Navbar.vue | 2 +-
src/utils/common.js | 12 +-
src/views/catalog/index.vue | 5 +-
src/views/catalog/to.vue | 11 +
src/views/dashboard/components/PanelGroup.vue | 2 +-
src/views/organize/to.vue | 11 +
src/views/record/index.vue | 242 ++++++++++--------
7 files changed, 173 insertions(+), 112 deletions(-)
create mode 100644 src/views/catalog/to.vue
create mode 100644 src/views/organize/to.vue
diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue
index 6219bf6..9b9f6f4 100644
--- a/src/layout/components/Navbar.vue
+++ b/src/layout/components/Navbar.vue
@@ -5,7 +5,7 @@
-
+
查询
diff --git a/src/utils/common.js b/src/utils/common.js
index ad543eb..fc1bbba 100644
--- a/src/utils/common.js
+++ b/src/utils/common.js
@@ -337,8 +337,10 @@ let base = {
return form
},
// 根据pid 重组树形结构
- buildTree(flatData) {
- // 创建一个映射表,用于存储每个 id 对应的数据项
+ buildTree(flatData,pidName) {
+ // 创建一个映射表,用于存储每个 id 对应的数据项
+ let pid = pidName ? pidName : 'pid'
+ console.log("pid",pid)
const idMap = {};
flatData.forEach(item => {
idMap[item.id] = item;
@@ -348,12 +350,12 @@ let base = {
flatData.forEach(item => {
// 如果没有父节点,则将该项添加到根节点集合中
- if (parseInt(item.pid) === 0) {
+ if (!item[pid] || parseInt(item[pid]) === 0) {
rootNodes.push(item);
} else {
// 否则,将该项添加到父节点的 children 数组中
- if(idMap[item.pid]){
- const parent = idMap[item.pid];
+ if(idMap[item[pid]]){
+ const parent = idMap[item[pid]];
// console.log("par",parent)
if (!parent.hasOwnProperty('children')) {
parent.children = [];
diff --git a/src/views/catalog/index.vue b/src/views/catalog/index.vue
index d6a9a0f..2e922a4 100644
--- a/src/views/catalog/index.vue
+++ b/src/views/catalog/index.vue
@@ -23,7 +23,7 @@
-
+
@@ -109,7 +109,8 @@
})
if (res.data.length > 0) {
this.list = this.base.buildTree(res.data)
-
+ }else{
+ this.list = []
}
},
diff --git a/src/views/catalog/to.vue b/src/views/catalog/to.vue
new file mode 100644
index 0000000..5defa47
--- /dev/null
+++ b/src/views/catalog/to.vue
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/views/dashboard/components/PanelGroup.vue b/src/views/dashboard/components/PanelGroup.vue
index ae559ee..f9b4e19 100644
--- a/src/views/dashboard/components/PanelGroup.vue
+++ b/src/views/dashboard/components/PanelGroup.vue
@@ -303,7 +303,7 @@
.box4 {
- background: linear-gradient(-55deg, #53241d,#b3241d);
+ background: linear-gradient(-55deg, #b3241d,#b3241d);
.boxcline {
width: 100%;
diff --git a/src/views/organize/to.vue b/src/views/organize/to.vue
new file mode 100644
index 0000000..5defa47
--- /dev/null
+++ b/src/views/organize/to.vue
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/views/record/index.vue b/src/views/record/index.vue
index 6061208..26fe15c 100644
--- a/src/views/record/index.vue
+++ b/src/views/record/index.vue
@@ -3,7 +3,7 @@
-
+
@@ -51,13 +51,13 @@
@change="changeEnd" v-model="select.endRange" type="daterange" format="yyyy-MM-dd"
value-format="yyyy-MM-dd" range-separator="至" start-placeholder="结束日期" end-placeholder="">
-
-
-
-
-
-
+
查询
@@ -66,6 +66,9 @@
新增
+
+
+ 返回上一级
@@ -81,17 +84,21 @@
-->
-
+
+
+
{{historyList.length>0?"返回上一级":""}}
+
-
+
@@ -131,25 +138,27 @@
-
-
-
-
-
- 查看
-
-
-
-
-
-
-
-
- 查看
-
-
-
+
@@ -259,8 +268,8 @@
}
}, {
text: '本周',
- onClick(picker) {
- const end = new Date();
+ onClick(picker) {
+ const end = new Date();
const start = new Date();
const date = new Date();
const today = new Date(date.getFullYear(), date.getMonth(), date.getDate());
@@ -269,32 +278,32 @@
const diff = 1 - today.getDay();
firstDay.setDate(today.getDate() + diff); // 获取本周第一天的日期
lastDay.setDate(today.getDate() + (6 - today.getDay() + 1)); // 获取本周最后一天的日期
- start.setTime(firstDay);
+ start.setTime(firstDay);
end.setTime(lastDay);
picker.$emit('pick', [start, end]);
}
}]
- },
- rsList:[{
- id:1,
- name:'是'
- },{
- id:0,
- name:'否'
+ },
+ rsList: [{
+ id: 1,
+ name: '是'
+ }, {
+ id: 0,
+ name: '否'
}],
select: {
title: '',
table_name: 'records',
page: 1,
- page_size: 10,
+ page_size: 9999,
catalog_id: '',
catalog_name: '',
status: '',
area_id: '',
tag_id: '',
startRange: [],
- endRange: [],
- records_status:''
+ endRange: [],
+ // records_status:''
},
hasMenu: false,
myHeight: 0,
@@ -306,9 +315,10 @@
label: 'name'
},
catalogList: [],
+ historyList: [],
+ menuName:[],
+ showData:[],
catalogChildren: [], // 存储所有数据
- showChildren: [], // 目前显示
- lastChildren: [], // 上一级
areaList: [],
tagList: [],
nowDate: '',
@@ -320,7 +330,7 @@
type: ''
}, {
id: 3,
- name: '已结束',
+ name: '已结束',
type: 'info'
}, {
id: 1,
@@ -340,19 +350,19 @@
label: '标题',
align: 'left',
width: 360,
- headerAlign: 'left'
+ headerAlign: 'center'
},
{
- prop: 'catalog_name',
- label: '所属目录',
+ prop: 'date',
+ label: '开始日期',
align: 'center',
- width: 240
+ width: 120
},
{
- prop: 'area_name',
- label: '区域',
+ prop: 'end_date',
+ label: '结束日期',
align: 'center',
- width: 240
+ width: 120
},
{
prop: 'tag_name',
@@ -361,36 +371,35 @@
width: 240
},
{
- prop: 'status',
- label: '状态',
+ prop: 'area_name',
+ label: '所属区域',
align: 'center',
- width: 120
- },
- {
- prop: 'link_id',
- label: '来源文档',
- align: 'center',
- width: 120
- },
- {
- prop: 'next_link_id',
- label: '延续文档',
- align: 'center',
- width: 120
+ width: 240
},
-
{
- prop: 'date',
- label: '开始日期',
+ prop: 'status',
+ label: '状态',
align: 'center',
width: 120
},
{
- prop: 'end_date',
- label: '结束日期',
+ prop: 'catalog_name',
+ label: '所属目录',
align: 'center',
- width: 120
- }
+ width: 240
+ },
+ // {
+ // prop: 'link_id',
+ // label: '来源文档',
+ // align: 'center',
+ // width: 120
+ // },
+ // {
+ // prop: 'next_link_id',
+ // label: '延续文档',
+ // align: 'center',
+ // width: 120
+ // },
]
@@ -410,27 +419,25 @@
this.select.endRange = [this.startDate, this.nowDate]
this.select.status = 0
this.is_search = true
- }
- if(this.$route.query.status1Total){
- this.select.status = 1
- this.is_search = true
+ }
+ if (this.$route.query.status1Total) {
+ this.select.status = 1
+ this.is_search = true
}
// this.getCatalogList()
// 分辨是有下级的 还是直接显示列表
if (this.$route.path) {
let path = this.$route.path.split("_")
this.select.catalog_id = path[1]
- console.log(this.$route.path.includes('menu'))
if (this.$route.path.includes('menu')) {
this.hasMenu = true
this.getCatalogList(path[1])
} else {
- this.getCatalogList()
- this.getAreaList()
- this.getTagList()
+ this.getCatalogList()
this.getList()
- }
-
+ }
+ this.getAreaList()
+ this.getTagList()
}
},
watch: {
@@ -475,6 +482,37 @@
}
},
+ clickIn(i) {
+ if (i.children && i.children.length > 0) {
+ this.historyList.push(this.showData);
+
+ this.showData = i.children;
+ this.menuName.push(i.name)
+ this.select.catalog_name = ' / ' + this.menuName.join(" / ")
+ console.log(this.historyList);
+ }else{
+ this.select.catalog_id = i.id
+ this.menuName.push(i.name)
+ this.select.catalog_name = ' / ' + this.menuName.join(" / ")
+ this.hasMenu = false
+ this.getList()
+ }
+ },
+ clickOut() {
+ if (this.historyList && this.historyList.length > 0) {
+ this.showData = this.historyList[this.historyList.length - 1]
+ this.menuName.splice(this.menuName.length-1,1)
+ this.select.catalog_name = ' / ' + this.menuName.join(" / ")
+ this.historyList.pop()
+ console.log(this.historyList);
+ }
+ },
+ goBack(){
+ this.select.catalog_id = ''
+ this.menuName.splice(this.menuName.length-1,1)
+ this.select.catalog_name = ' / ' + this.menuName.join(" / ")
+ this.hasMenu = true
+ },
async getCatalogList(pid) {
const res = await index({
page_size: 999,
@@ -489,7 +527,8 @@
if (pid) {
let pList = this.base.findNodesById(this.catalogList, pid)
console.log("pList", pList)
- this.catalogChildren = pList[0].children
+ this.catalogChildren = pList[0].children
+ this.showData = this.catalogChildren
}
}
},
@@ -536,24 +575,14 @@
this.$refs.showRecord.type = type
this.$refs.showRecord.isShow = true
},
-
- pageIndexChange(e) {
- this.select.page = e
- this.getList()
- },
- pageSizeChange(e) {
- this.select.page_size = e
- this.select.page = 1
- this.getList()
- },
resetSearch() {
this.select.page = 1
this.select.area_id = []
this.select.tag_id = []
this.select.startRange = []
- this.select.endRange = []
- this.select.records_status = ""
+ this.select.endRange = []
+ // this.select.records_status = ""
if (this.is_search) {
this.select.catalog_id = ''
this.select.catalog_name = ''
@@ -589,8 +618,8 @@
sort_name: 'date',
catalogs_id: this.select.catalog_id ? this.select.catalog_id : '',
area_ids: this.select.area_id ? this.select.area_id : '',
- tag_ids: this.select.tag_id ? this.select.tag_id : '',
- records_status:this.select.records_status,
+ tag_ids: this.select.tag_id ? this.select.tag_id : '',
+ // records_status:this.select.records_status,
filter: [{
"key": "title",
"op": "like",
@@ -609,8 +638,12 @@
value: this.select.status
}]
})
- this.list = res.data
- this.total = res.total
+ // this.list = res.data
+ if (res.data.length > 0) {
+ this.list = this.base.buildTree(res.data, 'link_id')
+ }else{
+ this.list = []
+ }
},
deleteList(id) {
var that = this;
@@ -650,7 +683,8 @@
.catalog {
&_list {
display: flex;
- align-items: center;
+ align-items: center;
+ flex-wrap: wrap;
}
&_item {
@@ -659,7 +693,9 @@
font-size: 18px;
margin: 20px;
cursor: pointer;
- color: #b3241d;
+ color: #b3241d;
+ width:150px;
+ height:130px;
i {
font-size: 40px;