lion 1 year ago
parent 923f5d3614
commit b5ac493ac6

@ -1,469 +0,0 @@
<template>
<div>
<div>
<div ref="lxHeader">
<lx-header icon="md-apps" :text="$route.meta.title" 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>
<el-input v-model="select.title" placeholder="请输入名称"></el-input>
</div>
<div>
<el-select style="width:100%" v-model="select.status" placeholder="请选择状态" clearable>
<el-option v-for="item in statusList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</div>
<div>
<el-select style="width:100%" v-model="select.area_id" clearable multiple collapse-tags
placeholder="请选择区域">
<el-option v-for="item in areaList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</div>
<div>
<el-select style="width:100%" v-model="select.tag_id" multiple collapse-tags placeholder="请选择标签">
<el-option v-for="item in tagList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</div>
<div>
<el-date-picker style="width:250px" @change="changeStart" v-model="select.startRange" type="daterange"
format="yyyy-MM-dd" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期"
end-placeholder="">
</el-date-picker>
</div>
<div>
<el-date-picker style="width:250px" @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-button type="primary" size="small" @click="select.page=1,getList()"></el-button>
</div>
<div>
<el-button type="primary" size="small" @click="resetSearch"></el-button>
</div>
</div>
</div>
</lx-header>
</div>
</div>
<div class="catalog">
<div class="catalog_right">
<xy-table @getHeight="initHeight" :list="list" :total="total" @pageIndexChange="pageIndexChange"
@pageSizeChange="pageSizeChange" :table-item="table_item">
<template v-slot:catalog_name>
<el-table-column align='left' label="所属目录" width="240" header-align="left">
<template slot-scope="scope">
<div v-if="scope.row.catalog_id_details && scope.row.catalog_id_details.length>0">
<el-tag style="margin-right:5px;margin-bottom:5px" v-for="item in scope.row.catalog_id_details">
{{item.name}}</el-tag>
</div>
</template>
</el-table-column>
</template>
<template v-slot:area_name>
<el-table-column align='left' label="所属区域" width="240" header-align="left">
<template slot-scope="scope">
<div v-if="scope.row.area_ids_details && scope.row.area_ids_details.length>0">
<el-tag style="margin-right:5px;margin-bottom:5px" v-for="item in scope.row.area_ids_details">
{{item.name}}</el-tag>
</div>
</template>
</el-table-column>
</template>
<template v-slot:tag_name>
<el-table-column align='left' label="标签" width="240" header-align="left">
<template slot-scope="scope">
<div v-if="scope.row.tag_ids_details && scope.row.tag_ids_details.length>0">
<el-tag style="margin-right:5px;margin-bottom:5px" v-for="item in scope.row.tag_ids_details">
{{item.name}}</el-tag>
</div>
</template>
</el-table-column>
</template>
<template v-slot:status>
<el-table-column align='center' label="状态" width="120" header-align="center">
<template slot-scope="scope">
<div v-for="item in statusList">
<el-tag :type="item.type" v-if="item.id===scope.row.status">
{{item.name}}</el-tag>
</div>
</template>
</el-table-column>
</template>
<template v-slot:btns>
<el-table-column align='left' fixed="right" label="操作" width="240" header-align="center">
<template slot-scope="scope">
<!-- <el-button type="primary" size="small" @click="editIndex('child',scope.row.id,scope.row.name)"></el-button> -->
<el-button type="primary" size="small" @click="showIndex('show',scope.row.id)"></el-button>
<!-- -->
<el-button v-if="stateObj.login_id===scope.row.admin_id || stateObj.is_admin" type="primary"
size="small" @click="editIndex('editor',scope.row.id)">编辑</el-button>
<el-popconfirm v-if="stateObj.login_id===scope.row.admin_id || stateObj.is_admin" style="margin:0 10px"
@confirm="deleteList(scope.row.id)" title="确定删除吗?">
<el-button type="danger" size="small" slot="reference">删除</el-button>
</el-popconfirm>
</template>
</el-table-column>
</template>
</xy-table>
</div>
</div>
<add-record ref="addRecord" @refresh="getRefresh"></add-record>
<addRecordLink ref="addRecordLink" @refresh="getList"></addRecordLink>
<show-record ref="showRecord"></show-record>
</div>
</template>
<script>
import addRecord from './components/addRecord.vue';
import addRecordLink from './components/addRecordLink.vue';
import showRecord from './components/showRecord.vue';
import {
index,
destroy
} from "@/api/system/baseForm.js"
import state from '@/store/modules/user.js'
export default {
components: {
addRecord,
addRecordLink,
showRecord
},
data() {
return {
select: {
title: '',
table_name: 'records',
page: 1,
page_size: 10,
catalog_id: '',
status: '',
area_id: '',
tag_id: '',
startRange: [],
endRange: []
},
myHeight: 0,
stateObj: {},
total: 0,
list: [],
defaultProps: {
children: 'children',
label: 'name'
},
catalogList: [],
areaList: [],
tagList: [],
nowDate: '',
statusList: [{
id: 0,
name: '正常',
type: ''
}, {
id: 1,
name: '已到期',
type: 'info'
}, {
id: 2,
name: '已延续',
type: 'success'
}],
table_item: [{
type: 'index',
width: 50,
fixed: 'left'
}, {
prop: 'title',
label: '标题',
align: 'left',
width: 360,
headerAlign: 'left'
},
{
prop: 'catalog_name',
label: '所属目录',
align: 'center',
width: 240
},
{
prop: 'area_name',
label: '区域',
align: 'center',
width: 240
},
{
prop: 'tag_name',
label: '标签',
align: 'center',
width: 240
},
{
prop: 'status',
label: '状态',
align: 'center',
width: 120
},
{
prop: 'date',
label: '开始日期',
align: 'center',
width: 120
},
{
prop: 'end_date',
label: '结束日期',
align: 'center',
width: 120
}
]
}
},
created() {
//
this.nowDate = this.$moment().format("YYYY-MM-DD")
this.stateObj = state.state
console.log("this.stateObj", this.stateObj)
if (this.$route.query.searchTitle) {
this.select.title = this.$route.query.searchTitle
}
if (this.$route.query.dateTotal) {
this.select.endRange = [this.nowDate, this.nowDate]
this.select.status = 0
}
this.getCatalogList()
this.getAreaList()
this.getTagList()
this.getList()
},
methods: {
initHeight(e) {
console.log("e", e)
this.myHeight = e + 37
},
async getCatalogList(pid) {
const res = await index({
page_size: 999,
page: 1,
sort_type: 'ASC',
sort_name: 'sort',
table_name: 'catalogs',
// is_auth: 1,
})
if (res.data.length > 0) {
this.catalogList = this.base.buildTree(res.data)
}
},
async getAreaList() {
const res = await index({
page_size: 999,
page: 1,
sort_type: 'ASC',
sort_name: 'sort',
table_name: 'areas',
})
this.areaList = res.data
},
async getTagList() {
const res = await index({
page_size: 999,
page: 1,
sort_type: 'ASC',
sort_name: 'sort',
table_name: 'record_tags',
is_auth: 1
})
this.tagList = res.data
},
getSelectedNodes(data, node, self) {
node.expanded = true
this.select.catalog_id = data.id
this.select.page = 1
this.getList()
},
editIndex(type, id) {
if (type == 'editor') {
this.$refs.addRecord.id = id
} else {
this.$refs.addRecord.setCheck(this.select.catalog_id)
}
// if(this.select.catalog_id){
// this.$refs.addRecord.setCatalogId(this.select.catalog_id)
// }
this.$refs.addRecord.setList(this.catalogList, this.areaList, this.tagList)
this.$refs.addRecord.type = type
this.$refs.addRecord.isShow = true
},
showIndex(type, id) {
this.$refs.showRecord.id = id
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.title = ''
this.select.area_id = []
this.select.tag_id = []
this.select.startRange = []
this.select.endRange = []
// this.select.catalog_id = ''
this.getList()
},
changeStart(e) {
if (e) {
this.select.startRange = e
} else {
this.select.startRange = []
}
},
changeEnd(e) {
if (e) {
this.select.endRange = e
} else {
this.select.endRange = ''
}
},
getRefresh(bol, id) {
if (bol) {
console.log('getRefresh', bol, id)
// if(this.select.catalog_id){
// this.$refs.addRecord.setCatalogId(this.select.catalog_id)
// }
this.$refs.addRecordLink.type = 'add'
this.$refs.addRecordLink.setLinkId(id)
this.$refs.addRecordLink.setList(this.catalogList, this.areaList, this.tagList)
this.$refs.addRecordLink.setCheck(this.select.catalog_id)
this.$refs.addRecordLink.isShow = true
}
this.getList()
},
async getList() {
const res = await index({
page_size: this.select.page_size,
page: this.select.page,
table_name: this.select.table_name,
json_data_fields: ['files', 'area_ids', 'tag_ids', 'catalog_id'],
is_auth: 1,
sort_type: 'DESC',
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 : '',
filter: [{
"key": "title",
"op": "like",
"value": this.select.title
}, {
key: 'date',
op: 'range',
value: this.select.startRange ? this.select.startRange : []
}, {
key: 'end_date',
op: 'range',
value: this.select.endRange ? this.select.endRange : []
}, {
key: 'status',
op: 'eq',
value: this.select.status
}]
})
this.list = res.data
this.total = res.total
},
deleteList(id) {
var that = this;
destroy({
id: id,
table_name: this.select.table_name
}).then(response => {
this.$Message.success('操作成功');
this.getList()
}).catch(error => {
console.log(error)
reject(error)
})
},
}
}
</script>
<style lang="scss" scoped>
.searchwrap {
display: flex;
align-items: center;
&>div {
display: flex;
align-items: center;
margin-right: 10px;
span {
min-width: 70px;
}
}
}
.catalog {
&_list {
display: flex;
align-items: center;
}
&_item {
// width:150px;
text-align: center;
font-size: 18px;
margin: 20px;
cursor: pointer;
color: #b3241d;
i {
font-size: 40px;
margin-bottom: 10px;
}
}
// display: flex;
// // align-items: center;
// justify-content: space-between;
// &_left {
// width: 20%;
// background: #fff;
// padding: 10px;
// }
// &_right {
// width: 79%
// }
}
</style>
Loading…
Cancel
Save