فهرست منبع

栏目列表 停用 删除

natasha 1 سال پیش
والد
کامیت
71bd4e2651

+ 5 - 0
src/router/index.js

@@ -129,6 +129,11 @@ export const constantRoutes = [{
         component: () =>
             import ('@/views/personal.vue')
     },
+    {
+        path: '/channelList',
+        component: () =>
+            import ('@/views/content_manage/newspaper_manage/ChannelList.vue')
+    },
     // 404 page must be placed at the end !!!
     { path: '*', redirect: '/', hidden: true }
 ]

+ 406 - 0
src/views/content_manage/newspaper_manage/ChannelList.vue

@@ -0,0 +1,406 @@
+<template>
+  <div class="manage-root edit-person">
+    <Header/>
+    <div class="manage-root-contain">
+        <div class="common-title-box">
+            <h3><i class="el-icon-arrow-left" @click="$router.go(-1)"></i>栏目模板</h3>
+            <div class="btn-box">
+                <el-button type="primary" size="small" @click="handleEdit">创建模板</el-button>
+            </div>
+        </div>
+        <div class="search-box">
+            <div class="search-item">
+                <label>搜索</label>
+                <el-input
+                    placeholder="输入搜索内容"
+                    v-model="searchInput">
+                    <i slot="suffix" class="el-input__icon el-icon-search" @click="getList(1)" style="cursor: pointer;"></i>
+                </el-input>
+            </div>
+            <div class="search-item">
+                <label>状态</label>
+                <el-select v-model="searchStatus" @change="getList" placeholder="请选择">
+                    <el-option
+                        v-for="item in channelStatusList"
+                        :key="item.value"
+                        :label="item.label"
+                        :value="item.value">
+                    </el-option>
+                </el-select>
+            </div>
+            <div class="search-item">
+                <label>学段</label>
+                <el-select v-model="searchStudy" @change="getList" placeholder="请选择">
+                    <el-option
+                        v-for="item in $studyTypeAll"
+                        :key="item.study_phase"
+                        :label="item.study_phase_name"
+                        :value="item.study_phase">
+                    </el-option>
+                </el-select>
+            </div>
+        </div>
+        <el-table
+            class="search-table"
+            :data="tableData"
+            style="width: 100%"
+            @sort-change="handleSort"
+            :default-sort = dataSort
+            :max-height="tableHeight">
+            <el-table-column
+                type="index"
+                label="#"
+                sortable
+                width="56">
+            </el-table-column>
+            <el-table-column
+                prop="tpl_name"
+                label="名称"
+                sortable
+                min-width="226">
+            </el-table-column>
+            <el-table-column
+                prop="study_phase"
+                label="学段"
+                width="72">
+                <template slot-scope="scope">
+                    {{formatterStudy(scope.row)}}
+                </template>
+            </el-table-column>
+            <el-table-column
+                prop="chn_count"
+                label="栏目数"
+                sortable
+                min-width="94">
+            </el-table-column>
+            <el-table-column
+                prop="creator_real_name"
+                label="创建人"
+                width="88"
+                sortable>
+            </el-table-column>
+            <el-table-column
+                prop="create_time"
+                label="创建时间"
+                width="144" 
+                sortable>
+                <template slot-scope="scope">
+                    {{scope.row.create_time?scope.row.create_time.substring(0,16):'-'}}
+                </template>
+            </el-table-column>
+            <el-table-column
+                prop="status"
+                label="状态"
+                width="104" >
+                <template slot-scope="scope">
+                    <div class="status-box">
+                        <span :style="{background:statusColorList[scope.row.tpl_status].bg}"></span>
+                        <b :style="{color:statusColorList[scope.row.tpl_status].color}">{{statusColorList[scope.row.tpl_status].text}}</b>
+                    </div>
+                </template>
+            </el-table-column>
+            <el-table-column
+                prop="tpl_note"
+                label="说明"
+                width="144">
+            </el-table-column>
+            <el-table-column
+                fixed="right"
+                label="操作"
+                width="220">
+                <template slot-scope="scope">
+                    <el-button
+                        @click.native.prevent="handleEdit(scope.row)"
+                        type="text"
+                        size="small"
+                        class="primary-btn">
+                        编辑
+                    </el-button>
+                    <el-button
+                        @click.native.prevent="handleUp(scope.row, scope.$index)"
+                        type="text"
+                        size="small"
+                        class="primary-btn"
+                        v-if="scope.row.tpl_status===0">
+                        启用
+                    </el-button>
+                    <el-button
+                        @click.native.prevent="handleUp(scope.row, scope.$index)"
+                        type="text"
+                        size="small"
+                        class="red-btn"
+                        v-else-if="scope.row.tpl_status===1">
+                        停用
+                    </el-button>
+                    <el-button
+                        @click.native.prevent="handleDelete(scope.row, scope.$index)"
+                        type="text"
+                        size="small"
+                        class="red-btn">
+                        删除
+                    </el-button>
+                </template>
+            </el-table-column>
+        </el-table>
+        <el-pagination
+            background
+            @size-change="handleSizeChange"
+            @current-change="handleCurrentChange"
+            :current-page="pageNumber"
+            :page-sizes="[10, 20, 30, 40]"
+            :page-size="pageSize"
+            layout="total, prev, pager, next, sizes, jumper"
+            :total="total_count">
+        </el-pagination>
+    </div>
+  </div>
+</template>
+
+<script>
+//这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
+//例如:import 《组件名称》from ‘《组件路径》';
+import Header from "../../../components/Header.vue";
+import { getLogin } from "@/api/ajax";
+
+export default {
+  //import引入的组件需要注入到对象中才能使用
+  components: { Header },
+  props: {},
+  data() {
+    //这里存放数据
+    return {
+        searchInput: '',
+        searchStudy: -1,
+        searchStatus: '',
+        pageSize: 10, 
+        pageNumber: 1,
+        dataSort: {},
+        channelStatusList: [
+            {
+                value: '',
+                label: '全部'
+            },
+            {
+                value: 1,
+                label: '已使用'
+            },
+            {
+                value: 0,
+                label: '未使用'
+            }
+        ],
+        statusColorList:{
+            0: {
+                text: '未使用',
+                bg: '#165DFF',
+                color: ''
+            },
+            1: {
+                text: '已使用',
+                bg: '#00B42A',
+                color: ''
+            }
+        },
+        tableData:[],
+        tableHeight: "", // 表格高度
+        total_count: 0,
+    }
+  },
+  //计算属性 类似于data概念
+  computed: {
+    
+  },
+  //监控data中数据变化
+  watch: {},
+  //方法集合
+  methods: {
+    handleEdit(row){
+        
+    },
+    getList(val){
+        if(val){
+            this.pageNumber = val
+        }
+        let MethodName = "/PaperServer/Manager/ChannelTplManager/PageQueryChannelTpl"
+        let order_column_list = []
+        if(this.dataSort != {}){
+            if(this.dataSort.order=='descending'){
+                order_column_list.push({
+                    name: this.dataSort.prop,
+                    asc: false
+                })
+            }else if(this.dataSort.order=='ascending'){
+                order_column_list.push({
+                    name: this.dataSort.prop,
+                    asc: true
+                })
+            }
+        }
+        let data = {
+            key_word: this.searchInput.trim(),
+            tpl_status: this.searchStatus,
+            study_phase: this.searchStudy===-1?null:this.searchStudy,
+            page_capacity:this.pageSize,
+            cur_page:this.pageNumber,
+            order_bys: order_column_list
+        }
+        getLogin(MethodName, data)
+        .then((res) => {
+            if(res.status===1){
+               this.tableData = res.data.list
+               this.total_count = res.data.total_count
+            }
+        })
+        .catch(() => {
+            this.loading = false
+        });
+    },
+    //计算table高度(动态设置table高度)
+    getTableHeight() {
+      let tableH = 370; //距离页面下方的高度
+      let tableHeightDetil = window.innerHeight - tableH;
+      if (tableHeightDetil <= 300) {
+        this.tableHeight = 300;
+      } else {
+        this.tableHeight = window.innerHeight - tableH;
+      }
+    },
+    // 处理学段
+    formatterStudy(row){
+        let studyCn = ''
+        let list = this.$studyTypeAll
+        if(row.study_phase){
+            for(let i=0;i<list.length;i++){
+                if(row.study_phase===list[i].study_phase){
+                    studyCn = list[i].study_phase_name
+                }
+            }
+        }else{
+            studyCn = '未知'
+        }
+        return studyCn
+    },
+    handleSort(value){
+        let dataSort = {
+            prop: value.prop,
+            order: value.order
+        }
+        this.dataSort = dataSort
+        this.getList()
+    },
+    handleSizeChange(val) {
+        this.pageSize = val
+        this.pageNumber = 1
+        this.getList()
+    },
+    handleCurrentChange(val) {
+        this.pageNumber = val
+        this.getList()
+    },
+    // 停用 启用
+    handleUp(row, index) {
+      let Mname = "/PaperServer/Manager/ChannelTplManager/EditChannelTplStatus";
+      let updataData = JSON.parse(JSON.stringify(row));
+      let data = {
+        id: row.id
+      };
+      if (row.tpl_status === 1) {
+        // 下架状态
+        data.tpl_status = 0;
+        updataData.tpl_status = 0;
+      } else if (row.tpl_status === 0) {
+        data.tpl_status = 1;
+        updataData.tpl_status = 1;
+      }
+      getLogin(Mname, data).then(res => {
+        this.$message.success("操作成功");
+        this.$set(this.tableData, index, updataData);
+      });
+    },
+    // 删除
+    handleDelete(row){
+        this.$confirm('确定删除吗?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+           let Mname = "/PaperServer/Manager/ChannelTplManager/DelChannelTplById";
+            let data = {
+                id: row.id,
+            };
+            getLogin(Mname, data).then(res => {
+                this.$message({
+                    type: 'success',
+                    message: '删除成功!'
+                });
+                this.getList(1)
+            });
+        }).catch(() => {
+          this.$message({
+            type: 'info',
+            message: '已取消删除'
+          });          
+        });
+    },
+  },
+  //生命周期 - 创建完成(可以访问当前this实例)
+  created() {
+    this.getList()
+    this.getTableHeight()
+  },
+  //生命周期 - 挂载完成(可以访问DOM元素)
+  mounted() {
+
+  },
+  //生命周期-创建之前
+  beforeCreated() { },
+  //生命周期-挂载之前
+  beforeMount() { },
+  //生命周期-更新之前
+  beforUpdate() { },
+  //生命周期-更新之后
+  updated() { },
+  //生命周期-销毁之前
+  beforeDestory() { },
+  //生命周期-销毁完成
+  destoryed() { },
+  //如果页面有keep-alive缓存功能,这个函数会触发
+  activated() { }
+}
+</script>
+<style lang="scss" scoped>
+/* @import url(); 引入css类 */
+.manage-root-contain{
+    width: 1192px;
+    margin: 16px auto;
+    border-radius: 4px;
+    background: #FFF;
+    padding: 24px;
+    display: block;
+    .common-title-box{
+        width: 100%;
+        .el-icon-arrow-left{
+            font-weight: 500;
+            margin-right: 8px;
+            cursor: pointer;
+        }
+    }
+    .status-box {
+        display: flex;
+        align-items: center;
+        span {
+            width: 6px;
+            height: 6px;
+            border-radius: 3px;
+            margin-right: 8px;
+            margin-top: 2px;
+        }
+        b {
+            font-weight: 400;
+            font-size: 14px;
+            line-height: 22px;
+            color: #1D2129;
+        }
+    }
+}
+</style>

+ 11 - 3
src/views/content_manage/newspaper_manage/CreateNewspaper.vue

@@ -26,9 +26,11 @@
                 </el-steps>
             </div>
             <div class="create-bottom">
-                <template v-if="stepIndex===0"></template>
-                <div class="step-div-1" v-if="stepIndex===1">
-                    
+                <template v-if="stepIndex===0">
+                    <a @click="handleLinkChannel">栏目模版维护</a> 
+                </template>
+                <div v-if="stepIndex===1">
+                   
                 </div>
                 <div v-if="stepIndex===2">
                     <el-result icon="success" :subTitle="id?'报纸编辑成功':'报纸创建成功'">
@@ -111,6 +113,12 @@ export default {
     handleCreate(){
         this.$router.replace('/createNewspaper')
         location.reload()
+    },
+    // 跳转栏目列表
+    handleLinkChannel(){
+        this.$router.push({
+            path:'/channelList'
+        })
     }
   },
   //生命周期 - 创建完成(可以访问当前this实例)