clearCache.vue 1.5 KB
<template>
  <el-dialog :title="userObj.title"
             :visible.sync="userObj.show"  center
      width="800px">
    <el-table
      :data="cacheList"
      style="width: 100%;">
      <el-table-column
        prop="name"
        label="缓存列表" style="padding-left:30px">
      </el-table-column>
      <el-table-column
        v-if="!$store.state.readonly"
        label="操作">
        <template slot-scope="scope">
          <el-button size="mini"  type="primary" @click="cache(scope.row.key)">
            清除缓存
          </el-button>
        </template>
      </el-table-column>
    </el-table>
  </el-dialog>
</template>
<script>
import {clearCacheListApi} from "../../../service/api"
export default {
  name:"ClearCache",
    props:[
      'userObj'
    ],
    data(){
     return{
            cacheList:[
              {name:"主题列表",key:"course_relation_list"},
              {name:"课包列表",key:"course_category_list "},
              {name:"课包内容",key:"element_detail"}
              ]
     }
    },
    methods:{
      cache(data){
        this.$confirm('此操作将清除该缓存记录?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
            clearCacheListApi(data).then(res=>{
            this.$message({
              type: 'success',
              message: '清除成功!'
            });
           });
         });

      }
    }
}
</script>
<style scoped lang="less">

</style>