master
lion 1 year ago
parent 0ff943145e
commit c487278833

@ -5,7 +5,7 @@
<breadcrumb class="breadcrumb-container" />
<div class="search-top">
<div>
<el-input style="width:300px" v-model="searchword" placeholder="请输入关键词查询"></el-input>
<el-input style="width:300px" v-model="searchword" @change="goRecord" placeholder="请输入关键词查询"></el-input>
</div>
<div>
<el-button type="primary" size="small" @click="goRecord"></el-button>

@ -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 = [];

@ -23,7 +23,7 @@
</div>
<div>
<xy-table :list="list" :isPage="false" rowKey="id" :table-item="table_item">
<xy-table :list="list" :isPage="false" :defaultExpandAll='false' rowKey="id" :table-item="table_item">
<template v-slot:btns>
<el-table-column align='center' label="操作" width="240" header-align="center">
<template slot-scope="scope">
@ -109,7 +109,8 @@
})
if (res.data.length > 0) {
this.list = this.base.buildTree(res.data)
}else{
this.list = []
}
},

@ -0,0 +1,11 @@
<template>
<div>
<router-view></router-view>
</div>
</template>
<script>
</script>
<style>
</style>

@ -303,7 +303,7 @@
.box4 {
background: linear-gradient(-55deg, #53241d,#b3241d);
background: linear-gradient(-55deg, #b3241d,#b3241d);
.boxcline {
width: 100%;

@ -0,0 +1,11 @@
<template>
<div>
<router-view></router-view>
</div>
</template>
<script>
</script>
<style>
</style>

@ -3,7 +3,7 @@
<div>
<div ref="lxHeader">
<lx-header icon="md-apps" :text="$route.meta.title" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
<lx-header icon="md-apps" :text="$route.meta.title+select.catalog_name" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
<div slot="content" v-if="!hasMenu">
<div class="searchwrap" style="display: flex;align-items: center;">
<div>
@ -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="">
</el-date-picker>
</div>
<div>
<el-select style="width:200px" v-model="select.records_status" placeholder="请选择是否到期">
<el-option v-for="item in rsList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</div>
<!-- <div>
<el-select style="width:200px" v-model="select.records_status" placeholder="请选择是否到期">
<el-option v-for="item in rsList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</div> -->
<div>
<el-button type="primary" size="small" @click="select.page=1,getList()"></el-button>
</div>
@ -66,6 +66,9 @@
</div>
<div>
<el-button type="primary" size="small" v-if="!is_search" @click="editIndex('add')"></el-button>
</div>
<div>
<el-button type="primary" size="small" v-if="!hasMenu && !is_search" @click="goBack()"></el-button>
</div>
</div>
</div>
@ -81,17 +84,21 @@
</el-tree>
</div> -->
<div v-if="hasMenu" class="catalog_list">
<div v-for="item in catalogChildren" class='catalog_item' @click="toUrl(item)">
<div v-for="item in showData" class='catalog_item' @click="clickIn(item)">
<div>
<i :class="item.children&&item.children.length>0?'el-icon-folder-opened':'el-icon-document-copy'"></i>
<div>{{item.name}}</div>
</div>
</div>
</div>
<div @click="clickOut" class="catalog_item">
<i v-if="historyList.length>0"
class="el-icon-arrow-left"></i>
<div>{{historyList.length>0?"返回上一级":""}}</div>
</div>
</div>
<div class="catalog_right" v-else>
<xy-table @getHeight="initHeight" :list="list" :total="total" @pageIndexChange="pageIndexChange"
@pageSizeChange="pageSizeChange" :table-item="table_item">
<xy-table @getHeight="initHeight" :defaultExpandAll='false' :isPage="false" rowKey="id" :list="list" :table-item="table_item">
<template v-slot:catalog_name>
<el-table-column align='center' label="所属目录" width="240" header-align="center">
<template slot-scope="scope">
@ -131,25 +138,27 @@
</div>
</template>
</el-table-column>
</template>
<template v-slot:link_id>
<el-table-column align='center' label="前续文档" width="120" header-align="center">
<template slot-scope="scope">
<div style="color:#b3241d;cursor: pointer;text-decoration: underline;" v-if="scope.row.link_id" @click="showIndex('show',scope.row.link_id)">
查看
</div>
</template>
</el-table-column>
</template>
<template v-slot:next_link_id>
<el-table-column align='center' label="延续文档" width="120" header-align="center">
<template slot-scope="scope">
<div style="color:#b3241d;cursor: pointer;text-decoration: underline;" v-if="scope.row.next_link_id" @click="showIndex('show',scope.row.next_link_id)">
查看
</div>
</template>
</el-table-column>
</template>
<!-- <template v-slot:link_id>
<el-table-column align='center' label="前续文档" width="120" header-align="center">
<template slot-scope="scope">
<div style="color:#b3241d;cursor: pointer;text-decoration: underline;" v-if="scope.row.link_id"
@click="showIndex('show',scope.row.link_id)">
查看
</div>
</template>
</el-table-column>
</template>
<template v-slot:next_link_id>
<el-table-column align='center' label="延续文档" width="120" header-align="center">
<template slot-scope="scope">
<div style="color:#b3241d;cursor: pointer;text-decoration: underline;" v-if="scope.row.next_link_id"
@click="showIndex('show',scope.row.next_link_id)">
查看
</div>
</template>
</el-table-column>
</template> -->
<template v-slot:btns>
<el-table-column align='center' fixed="right" label="操作" width="240" header-align="center">
@ -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;

Loading…
Cancel
Save