|
@@ -1,20 +1,194 @@
|
|
|
<template>
|
|
|
<div id="index">
|
|
|
- <p>index</p>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-col :span="24" class="add" style="text-align:right;padding: 10px 20px;">
|
|
|
+ <el-button size="mini" type="primary" @click="toAdd" icon="el-icon-plus">添加{{ theme }}</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" class="main">
|
|
|
+ <el-tabs v-model="activeName" type="card">
|
|
|
+ <el-tab-pane label="专家问诊" name="first">
|
|
|
+ <data-table :fields="fields" :opera="opera" @edit="toEdit" :data="list" :total="total" @delete="toDelete" @query="search"></data-table>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="行业研究" name="second">
|
|
|
+ <data-table :fields="fields" :opera="opera" @edit="toEdit" :data="oneList" :total="oneTotal" @delete="toDelete" @query="search"></data-table>
|
|
|
+ </el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
+ </el-col>
|
|
|
+ <el-dialog :title="theme" width="60%" :visible.sync="dialog" @closed="handleClose" :destroy-on-close="true">
|
|
|
+ <el-form ref="form" :rules="rules" :model="form" label-width="80px">
|
|
|
+ <el-form-item label="信息标题" prop="title">
|
|
|
+ <el-input v-model="form.title" placeholder="请输入信息标题"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="来源">
|
|
|
+ <el-input v-model="form.orgin" placeholder="请输入信息来源"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="所属栏目" placeholder="请选择所属栏目">
|
|
|
+ <el-select v-model="form.column_id" filterable @change="selectChild">
|
|
|
+ <el-option v-for="(item, index) in columnList" :key="index" :value="item.id" :label="item.name"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="标题简介">
|
|
|
+ <el-input type="textarea" v-model="form.titlejj" placeholder="请输入标题简介"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="信息图片" prop="picture">
|
|
|
+ <uploadone :limit="1" :data="form.picture" type="picture" :url="'/files/imgpath/upload'" @upload="uploadSuccess"></uploadone>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="视频" prop="filepath">
|
|
|
+ <upload :limit="1" :data="form.filepath" type="filepath" listType="" :url="'/files/imgpath/upload'" @upload="uploadSuccess"></upload>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="信息内容">
|
|
|
+ <wang-editor v-model="form.content" placeholder="请输入信息内容"></wang-editor>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="发布时间">
|
|
|
+ <el-col :span="11">
|
|
|
+ <el-date-picker type="date" placeholder="发布时间" value-format="yyyy-MM-dd" v-model="form.publish_time" style="width: 100%;"></el-date-picker>
|
|
|
+ </el-col>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" @click="onSubmit()">提交</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </el-dialog>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import uploadone from '@/components/uploadone.vue';
|
|
|
+import upload from '@/components/upload.vue';
|
|
|
+import WangEditor from '@/components/wang-editor.vue';
|
|
|
+import dataTable from '@/components/data-table.vue';
|
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions: liveTechnicalColumn } = createNamespacedHelpers('liveTechnicalColumn');
|
|
|
+const { mapActions: liveTechnicalNews } = createNamespacedHelpers('liveTechnicalNews');
|
|
|
export default {
|
|
|
name: 'index',
|
|
|
props: {},
|
|
|
- components: {},
|
|
|
+ components: {
|
|
|
+ dataTable,
|
|
|
+ uploadone,
|
|
|
+ upload,
|
|
|
+ WangEditor,
|
|
|
+ },
|
|
|
data: function() {
|
|
|
- return {};
|
|
|
+ return {
|
|
|
+ theme: '技术交流信息',
|
|
|
+ activeName: 'first',
|
|
|
+ opera: [
|
|
|
+ {
|
|
|
+ label: '编辑',
|
|
|
+ icon: 'el-icon-edit',
|
|
|
+ method: 'edit',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '删除',
|
|
|
+ icon: 'el-icon-delete',
|
|
|
+ method: 'delete',
|
|
|
+ confirm: true,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ fields: [
|
|
|
+ { label: '标题', prop: 'title', filter: 'input' },
|
|
|
+ { label: '所属栏目', prop: 'column_name' },
|
|
|
+ { label: '來源', prop: 'orgin' },
|
|
|
+ { label: '簡介', prop: 'titlejj' },
|
|
|
+ ],
|
|
|
+ list: [],
|
|
|
+ total: 0,
|
|
|
+ oneList: [],
|
|
|
+ oneTotal: 0,
|
|
|
+ dialog: false,
|
|
|
+ form: {},
|
|
|
+ rules: {},
|
|
|
+ columnList: [],
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.search();
|
|
|
+ this.searchColumn();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ ...liveTechnicalColumn(['query', 'delete', 'fetch']),
|
|
|
+ ...liveTechnicalNews({ queryList: 'query', createList: 'create', updateList: 'update', deleteList: 'delete' }),
|
|
|
+ async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
+ const res = await this.queryList({ skip, limit, column_name: '专家问诊' });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `list`, res.data);
|
|
|
+ this.$set(this, `total`, res.total);
|
|
|
+ }
|
|
|
+ const arr = await this.queryList({ skip, limit, column_name: '行业研究' });
|
|
|
+ if (this.$checkRes(arr)) {
|
|
|
+ this.$set(this, `oneList`, arr.data);
|
|
|
+ this.$set(this, `oneTotal`, arr.total);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 栏目
|
|
|
+ async searchColumn({ ...info } = {}) {
|
|
|
+ const res = await this.query({ ...info });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `columnList`, res.data);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 添加信息
|
|
|
+ toAdd() {
|
|
|
+ this.dialog = true;
|
|
|
+ },
|
|
|
+ // 提交
|
|
|
+ async onSubmit() {
|
|
|
+ if (this.form.id) {
|
|
|
+ let res = await this.updateList(this.form);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$message({
|
|
|
+ message: '修改信息成功',
|
|
|
+ type: 'success',
|
|
|
+ });
|
|
|
+ this.handleClose();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ let res = await this.createList(this.form);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$message({
|
|
|
+ message: '添加信息成功',
|
|
|
+ type: 'success',
|
|
|
+ });
|
|
|
+ this.handleClose();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 修改
|
|
|
+ toEdit({ data }) {
|
|
|
+ this.$set(this, 'form', data);
|
|
|
+ this.dialog = true;
|
|
|
+ },
|
|
|
+ // 刪除
|
|
|
+ async toDelete({ data }) {
|
|
|
+ const res = await this.deleteList(data.id);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$message({
|
|
|
+ message: '删除信息成功',
|
|
|
+ type: 'success',
|
|
|
+ });
|
|
|
+ this.search();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 取消
|
|
|
+ handleClose() {
|
|
|
+ this.form = {};
|
|
|
+ this.dialog = false;
|
|
|
+ },
|
|
|
+ selectChild(column_id) {
|
|
|
+ let res = this.columnList.filter(fil => fil.id === column_id);
|
|
|
+ if (res.length > 0) {
|
|
|
+ this.$set(this.form, `column_name`, res[0].name);
|
|
|
+ }
|
|
|
+ this.$forceUpdate();
|
|
|
+ },
|
|
|
+ uploadSuccess({ type, data }) {
|
|
|
+ this.$set(this.form, `${type}`, data.uri);
|
|
|
+ },
|
|
|
},
|
|
|
- created() {},
|
|
|
- methods: {},
|
|
|
computed: {
|
|
|
...mapState(['user']),
|
|
|
pageTitle() {
|