parent
28077c3aae
commit
037395df99
@ -0,0 +1,257 @@
|
||||
<template>
|
||||
<div class="container">
|
||||
<!-- 查询配置 -->
|
||||
<div style="padding: 0px 20px">
|
||||
<div ref="lxHeader">
|
||||
<LxHeader icon="md-apps" text="内容管理" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
|
||||
<div slot="content"></div>
|
||||
<slot>
|
||||
<div>
|
||||
<Input style="width: 200px; margin-right: 10px" v-model="searchFields.KeyWord" placeholder="关键字搜索" />
|
||||
<Button type="primary" @click="load" style="margin-left: 10px">查询</Button>
|
||||
</div>
|
||||
</slot>
|
||||
</LxHeader>
|
||||
</div>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="3">
|
||||
<Card class="box-card">
|
||||
<div style="overflow: auto;" :style="{height:tableHeight-32+'px'}">
|
||||
<el-scrollbar style="flex: 1">
|
||||
<el-tree class="filter-tree" highlight-current @node-click="menuClick" accordion :data="options"
|
||||
:props="defaultProps" ref="tree">
|
||||
</el-tree>
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
</Card>
|
||||
</el-col>
|
||||
<el-col :span="21">
|
||||
<div class="table-tree">
|
||||
<el-table :data="tableData" class="v-table" :height="tableHeight" border style="width: 100%">
|
||||
<el-table-column type="index" align="center">
|
||||
</el-table-column>
|
||||
<el-table-column prop="menu" align="left" label="归属目录" width="180">
|
||||
<template slot-scope="scope">
|
||||
<el-tag>{{scope.row.menu?scope.row.menu.name:"无"}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="title" label="标题">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.title}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="created_at" align="center" label="创建日期" width="180">
|
||||
</el-table-column>
|
||||
<el-table-column fixed="right" label="操作" width="300">
|
||||
<template slot-scope="scope">
|
||||
<Button ghost size="small" @click="show(scope.row)" type="primary"
|
||||
style="margin-left: 10px;">查看</Button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination">
|
||||
<el-pagination background @current-change="handleCurrentChange" :current-page="pagination.page"
|
||||
:page-size="pagination.page_size" layout="total,prev, pager, next" :total="pagination.total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-dialog title="内容查看" :visible.sync="dialogViewVisible" fullscreen>
|
||||
<div class="dialogConcent" :style="{height:clientHeight+'px'}">
|
||||
<el-scrollbar style="flex: 1">
|
||||
<el-form :model="form" ref="form" label-position="right" :label-width="formLabelWidth">
|
||||
<el-form-item label="标题" prop="title">
|
||||
{{form.title}}
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="目录" prop="menu_id">
|
||||
<el-tag>{{form.menu?form.menu.name:"无"}}</el-tag>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="内容" prop="content">
|
||||
<div style="width: 99.9%;" v-html="form.content">
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="附件" prop="file_list">
|
||||
<el-link v-for="item in form.file_list" target="_blank" :href="item.url" type="primary">{{item.original_name}}</el-link>
|
||||
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogViewVisible=false">关 闭</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getToken
|
||||
} from '@/utils/auth'
|
||||
import LxHeader from "@/components/LxHeader/index.vue";
|
||||
import Treeselect from "@riophae/vue-treeselect";
|
||||
import Tinymce from '@/components/Tinymce'
|
||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||
import {
|
||||
save,
|
||||
listarticle,
|
||||
store,
|
||||
del,
|
||||
get
|
||||
} from "../../api/lawsfile/article.js";
|
||||
import {
|
||||
listregulation
|
||||
} from "../../api/lawsfile/regulation.js";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
LxHeader,
|
||||
Treeselect,
|
||||
Tinymce
|
||||
},
|
||||
created() {
|
||||
var that = this;
|
||||
that.fileList = [];
|
||||
that.uploadOther.token = getToken();
|
||||
that.initLoad();
|
||||
that.loadregulation();
|
||||
that.load();
|
||||
},
|
||||
mounted() {},
|
||||
data() {
|
||||
return {
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'name'
|
||||
},
|
||||
uploadOther: {
|
||||
token: ""
|
||||
},
|
||||
dialogViewVisible: false,
|
||||
dialogFormVisible: false,
|
||||
formLabelWidth: "120px",
|
||||
form: {
|
||||
title: "",
|
||||
menu_id: null,
|
||||
content: "",
|
||||
file_list: ""
|
||||
},
|
||||
options: [],
|
||||
normalizer(node) {
|
||||
return {
|
||||
id: node.id,
|
||||
label: node.name,
|
||||
children: node.children,
|
||||
}
|
||||
},
|
||||
rules: {
|
||||
title: [{
|
||||
required: true,
|
||||
message: '请输入标题',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
menu_id: [{
|
||||
required: true,
|
||||
message: '请选择归属的目录',
|
||||
trigger: 'blur'
|
||||
}]
|
||||
},
|
||||
tableHeight: 0,
|
||||
//查询条件字段
|
||||
searchFields: {
|
||||
KeyWord: "",
|
||||
menu_id: ""
|
||||
},
|
||||
tableData: [],
|
||||
pagination: {
|
||||
page: 1,
|
||||
page_size: 15,
|
||||
total: 0
|
||||
},
|
||||
clientHeight: 0,
|
||||
fileList: [],
|
||||
filterText: ""
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
menuClick(data) {
|
||||
|
||||
let that = this;
|
||||
that.searchFields.menu_id = data.id;
|
||||
that.load();
|
||||
},
|
||||
filterNode(value, data) {
|
||||
if (!value) return true;
|
||||
return data.label.indexOf(value) !== -1;
|
||||
},
|
||||
initLoad() {
|
||||
var that = this;
|
||||
var clientHeight = document.documentElement.clientHeight
|
||||
var lxHeader_height = 96.5; //查询 头部
|
||||
var paginationHeight = 37; //分页的高度
|
||||
var topHeight = 50; //页面 头部
|
||||
let tableHeight = clientHeight - lxHeader_height - topHeight - paginationHeight - 20;
|
||||
that.tableHeight = tableHeight;
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.pagination.page = val;
|
||||
this.load();
|
||||
},
|
||||
loadregulation() {
|
||||
var that = this;
|
||||
listregulation(1).then(response => {
|
||||
that.options = response;
|
||||
}).catch(error => {
|
||||
console.log(error)
|
||||
//reject(error)
|
||||
})
|
||||
},
|
||||
load() {
|
||||
var that = this;
|
||||
listarticle(that.pagination.page, that.searchFields.menu_id, that.searchFields.KeyWord, that.pagination
|
||||
.page_size).then(response => {
|
||||
that.tableData = response.data;
|
||||
that.pagination.total = response.total;
|
||||
}).catch(error => {
|
||||
console.log(error)
|
||||
//reject(error)
|
||||
})
|
||||
},
|
||||
show(obj) {
|
||||
this.clientHeight = document.documentElement.clientHeight - 84 - 110;
|
||||
this.dialogViewVisible = true;
|
||||
this.info(obj);
|
||||
},
|
||||
info(obj) {
|
||||
var that = this;
|
||||
get(obj.id).then(response => {
|
||||
let result = Object.assign(that.form, response);
|
||||
that.form = result;
|
||||
let _files = [];
|
||||
for (var mod of result.files) {
|
||||
let m = Object.assign({}, mod);
|
||||
m.name = mod.original_name;
|
||||
_files.push(m);
|
||||
}
|
||||
// that.fileList = _files;
|
||||
that.form.file_list = _files;
|
||||
}).catch(error => {
|
||||
//reject(error)
|
||||
})
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.dialogConcent {
|
||||
overflow-y: auto;
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in new issue