|
@@ -1,31 +1,300 @@
|
|
|
<template>
|
|
|
<div id="index">
|
|
|
<el-row>
|
|
|
- <el-col :span="24">
|
|
|
- <p>index</p>
|
|
|
+ <el-col :span="24" class="main">
|
|
|
+ <breadcrumb :breadcrumbTitle="this.$route.meta.title"></breadcrumb>
|
|
|
+ <el-col :span="24" class="container">
|
|
|
+ <el-col :span="6" class="column">
|
|
|
+ <el-col :span="6" class="txt">
|
|
|
+ 栏目列表
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="18" class="btn">
|
|
|
+ <el-button type="primary" size="mini" @click="coldialog = true"><i class="el-icon-plus"></i></el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <data-table
|
|
|
+ :fields="columnfields"
|
|
|
+ :opera="columnopera"
|
|
|
+ :data="column"
|
|
|
+ @view="coltoView"
|
|
|
+ @edit="coltoEdit"
|
|
|
+ @delete="coltoDelete"
|
|
|
+ :usePage="false"
|
|
|
+ ></data-table>
|
|
|
+ </el-col>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="18" class="news">
|
|
|
+ <el-col :span="6" class="txt">
|
|
|
+ 信息列表
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="18" class="btn">
|
|
|
+ <el-button type="primary" size="mini" @click="addnews()"><i class="el-icon-plus"></i></el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <data-table
|
|
|
+ :fields="newfields"
|
|
|
+ :opera="newopera"
|
|
|
+ :data="newslist"
|
|
|
+ @query="searchnews"
|
|
|
+ :toFormat="toFormat"
|
|
|
+ :total="total"
|
|
|
+ @edit="newtoEdit"
|
|
|
+ @delete="newtoDelete"
|
|
|
+ ></data-table>
|
|
|
+ </el-col>
|
|
|
+ </el-col>
|
|
|
+ </el-col>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
+ <el-dialog :visible.sync="coldialog" title="栏目" @close="coltoClose" width="30%">
|
|
|
+ <data-form :data="colform" :fields="colFields" :rules="{}" @save="turnSave">
|
|
|
+ <template #options="{item}">
|
|
|
+ <template v-if="item.model === 'site'">
|
|
|
+ <el-option label="政策卡片" value="zckp"></el-option>
|
|
|
+ <el-option label="政策报告" value="zcbg"></el-option>
|
|
|
+ <el-option label="政策书籍" value="zcsj"></el-option>
|
|
|
+ <el-option label="政策解读" value="zcjd"></el-option>
|
|
|
+ <el-option label="创新平台园区" value="cxptyq"></el-option>
|
|
|
+ <el-option label="税收与金融" value="ssyjr"></el-option>
|
|
|
+ <el-option label="知识产权" value="zscq"></el-option>
|
|
|
+ <el-option label="科技人才" value="kjrc"></el-option>
|
|
|
+ <el-option label="科技成果转化" value="kjcgzh"></el-option>
|
|
|
+ <el-option label="综合政策指导" value="zhzczd"></el-option>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ </data-form>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import breadcrumb from '@c/common/breadcrumb.vue';
|
|
|
+import dataTable from '@/components/frame/filter-page-table.vue';
|
|
|
+import dataForm from '@/components/frame/form.vue';
|
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions: policyColumn } = createNamespacedHelpers('policyColumn');
|
|
|
+const { mapActions: policyNews } = createNamespacedHelpers('policyNews');
|
|
|
export default {
|
|
|
metaInfo() {
|
|
|
return { title: this.$route.meta.title };
|
|
|
},
|
|
|
name: 'index',
|
|
|
props: {},
|
|
|
- components: {},
|
|
|
+ components: {
|
|
|
+ breadcrumb,
|
|
|
+ dataTable,
|
|
|
+ dataForm,
|
|
|
+ },
|
|
|
data: function() {
|
|
|
- return {};
|
|
|
+ return {
|
|
|
+ // 栏目
|
|
|
+ columnopera: [
|
|
|
+ {
|
|
|
+ label: '查询信息',
|
|
|
+ icon: 'el-icon-view',
|
|
|
+ method: 'view',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '修改',
|
|
|
+ icon: 'el-icon-edit',
|
|
|
+ method: 'edit',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '删除',
|
|
|
+ icon: 'el-icon-delete',
|
|
|
+ method: 'delete',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ columnfields: [{ label: '名称', prop: 'name' }],
|
|
|
+ column: [],
|
|
|
+ coldialog: false,
|
|
|
+ colform: {},
|
|
|
+ colFields: [
|
|
|
+ { label: '名称', model: 'name' },
|
|
|
+ { label: '所在位置', model: 'site', type: 'select' },
|
|
|
+ ],
|
|
|
+ // 信息
|
|
|
+ newopera: [
|
|
|
+ {
|
|
|
+ label: '修改',
|
|
|
+ icon: 'el-icon-edit',
|
|
|
+ method: 'edit',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '删除',
|
|
|
+ icon: 'el-icon-delete',
|
|
|
+ method: 'delete',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ newfields: [
|
|
|
+ { label: '名称', prop: 'title', showTip: true },
|
|
|
+ { label: '信息来源', prop: 'orgin' },
|
|
|
+ { label: '所属栏目', prop: 'column_id', format: true },
|
|
|
+ ],
|
|
|
+ newslist: [],
|
|
|
+ total: 0,
|
|
|
+ column_id: '',
|
|
|
+ };
|
|
|
+ },
|
|
|
+ async created() {
|
|
|
+ await this.searchcolumn();
|
|
|
+ await this.searchnews();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ ...policyColumn({ colquery: 'query', colfetch: 'fetch', coldelete: 'delete', colcreate: 'create', colupdate: 'update' }),
|
|
|
+ ...policyNews({ newquery: 'query', newfetch: 'fetch', newdelete: 'delete', newcreate: 'create', newupdate: 'update' }),
|
|
|
+ // 查询栏目
|
|
|
+ async searchcolumn() {
|
|
|
+ const res = await this.colquery();
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `column`, res.data);
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: '查询失败',
|
|
|
+ type: 'error',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 栏目修改
|
|
|
+ coltoEdit({ data }) {
|
|
|
+ this.coldialog = true;
|
|
|
+ this.$set(this, `colform`, data);
|
|
|
+ },
|
|
|
+ // 栏目删除
|
|
|
+ async coltoDelete({ data }) {
|
|
|
+ const res = await this.coldelete(data.id);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$message({
|
|
|
+ message: '刪除成功',
|
|
|
+ type: 'success',
|
|
|
+ });
|
|
|
+ this.coltoClose();
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: '删除失败',
|
|
|
+ type: 'error',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 栏目添加
|
|
|
+ async turnSave({ data }) {
|
|
|
+ if (data.id) {
|
|
|
+ const res = await this.colupdate(data);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$message({
|
|
|
+ message: '修改成功',
|
|
|
+ type: 'success',
|
|
|
+ });
|
|
|
+ this.coltoClose();
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: '修改失败',
|
|
|
+ type: 'error',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ const res = await this.colcreate(data);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$message({
|
|
|
+ message: '添加成功',
|
|
|
+ type: 'success',
|
|
|
+ });
|
|
|
+ this.coltoClose();
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: '添加失败',
|
|
|
+ type: 'error',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 栏目取消
|
|
|
+ coltoClose() {
|
|
|
+ this.form = {};
|
|
|
+ this.coldialog = false;
|
|
|
+ this.searchcolumn();
|
|
|
+ },
|
|
|
+ // 查询信息
|
|
|
+ coltoView({ data }) {
|
|
|
+ this.$set(this, `column_id`, data.id);
|
|
|
+ this.searchnews();
|
|
|
+ },
|
|
|
+ // 查询信息
|
|
|
+ async searchnews({ skip = 0, limit = 10 } = {}) {
|
|
|
+ let res = await this.newquery({ skip, limit, column_id: this.column_id });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `newslist`, res.data);
|
|
|
+ this.$set(this, `total`, res.total);
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: '查询失败',
|
|
|
+ type: 'error',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 过滤栏目
|
|
|
+ toFormat({ model, value }) {
|
|
|
+ if (model == 'column_id') {
|
|
|
+ const res = this.column.find(f => f.id == value);
|
|
|
+ if (res) return res.name;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 添加信息
|
|
|
+ addnews() {
|
|
|
+ this.$router.push({ path: 'policy/detail' });
|
|
|
+ },
|
|
|
+ // 修改信息
|
|
|
+ newtoEdit({ data }) {
|
|
|
+ this.$router.push({ path: 'policy/detail', query: { id: data.id } });
|
|
|
+ },
|
|
|
+ // 删除信息
|
|
|
+ async newtoDelete({ data }) {
|
|
|
+ const res = await this.newdelete(data.id);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$message({
|
|
|
+ message: '刪除成功',
|
|
|
+ type: 'success',
|
|
|
+ });
|
|
|
+ this.searchnews();
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: '删除失败',
|
|
|
+ type: 'error',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
- created() {},
|
|
|
- methods: {},
|
|
|
computed: {
|
|
|
...mapState(['user']),
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
-<style lang="less" scoped></style>
|
|
|
+<style lang="less" scoped>
|
|
|
+.main {
|
|
|
+ .column {
|
|
|
+ min-height: 850px;
|
|
|
+ padding: 10px;
|
|
|
+ border: 1px solid #ccc;
|
|
|
+ .txt {
|
|
|
+ margin: 0 0 15px 0;
|
|
|
+ }
|
|
|
+ .btn {
|
|
|
+ text-align: right;
|
|
|
+ margin: 0 0 15px 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .news {
|
|
|
+ min-height: 850px;
|
|
|
+ padding: 10px;
|
|
|
+ border: 1px solid #ccc;
|
|
|
+ .txt {
|
|
|
+ margin: 0 0 15px 0;
|
|
|
+ }
|
|
|
+ .btn {
|
|
|
+ text-align: right;
|
|
|
+ margin: 0 0 15px 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|