| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287 |
- <style>
- .label{
- margin-right: 10px;
- }
- .table-body {
- padding: 20px;
- background-color: #fff;
- }
- .input-item {
- display: inline-block;
- width: 250px;
- margin: 0 0 20px;
- }
- .input-item .el-input__inner {
- border-right: 0;
- }
- .input-item .el-input__inner:hover {
- border: 1px solid #dcdfe6;
- border-right: 0;
- outline: 0;
- }
- .input-item .el-input__inner:focus {
- border: 1px solid #dcdfe6;
- border-right: 0;
- outline: 0;
- }
- .input-item .el-input-group__append {
- background-color: #fff;
- border-left: 0;
- width: 10%;
- padding: 0;
- }
- .input-item .el-input-group__append .el-button {
- padding: 0;
- }
- .input-item .el-input-group__append .el-button {
- margin: 0;
- }
- .table-body .el-button {
- padding: 0 !important;
- border: 0;
- margin: 0 5px;
- }
- .el-table th > .cell {
- color: #333;
- font-weight: bold;
- font-size: 14px;
- }
- .el-table__footer-wrapper, .el-table__header-wrapper {
- border-bottom: 1.4px solid #D6D6D6;
- }
- .el-button--primary2 {
- color: #FFF;
- background-color: #03C5FF;
- border-color: #03C5FF;
- }
- /*头像样式 start*/
- .default-avatar{
- width: 50px;
- height: 50px;
- border-radius: 50%;
- }
- .user_img{
- position: relative;
- margin-right: 8px;
- height: 50px;
- width: 50px;
- }
- .el-table_1_column_3 .cell { /*-2 表示在第二行*/
- display: flex;
- }
- /*头像样式 end*/
- </style>
- <div id="app" v-cloak>
- <el-card shadow="never" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
- <div slot="header">
- <div>
- <span>证书管理</span>
- </div>
- </template>
- </div>
- <div class="table-body">
- <el-button class="el-button--primary2" style="padding: 9px 15px!important; float: right;" type="primary"
- @click="handle('add')" size="small">添加证书
- </el-button>
- <div size="small" :inline="true" flex="dir:left cross:center" style="margin-bottom: 12px;">
- <div class="item-box" flex="dir:left cross:center" style="margin-left: 10px;">
- <div class="label">支付时间: </div>
- <el-date-picker
- size="small"
- v-model="search.create_time"
- type="datetimerange"
- value-format="yyyy-MM-dd HH:mm:ss"
- range-separator="至"
- start-placeholder="开始日期"
- end-placeholder="结束日期">
- </el-date-picker>
- </div>
- <div class="item-box" flex="dir:left cross:center" style="margin-right: 20px; margin-left: 20px;">
- <div class="label">证书名称: </div>
- <el-input size="small" style="width: 210px" v-model="search.name" placeholder="请输入证书名称"></el-input>
- </div>
- <div class="item-box" flex="dir:left cross:center">
- <el-button type="primary" style="padding: 9px 15px!important;" @click="searchs">搜索
- </el-button>
- <el-button type="danger" style="padding: 12px 34px !important;" size="small" @click="resetSearch" v-if="show_clear_search_btn">清除条件</el-button>
- </div>
- </div>
- <el-table v-loading="listLoading" :data="list" stripe style="width: 100%">
- <el-table-column prop="id" label="ID" min-width="80" align="center"></el-table-column>
- <el-table-column label="证书名称" align="center">
- <template slot-scope="scope">
- {{scope.row.name}}
- </template>
- </el-table-column>
- <el-table-column label="下载次数" width="80" align="center">
- <template slot-scope="scope">
- {{scope.row.download_num}}
- </template>
- </el-table-column>
- <el-table-column label="状态" align="center">
- <template slot-scope="scope">
- <el-switch active-value="1" inactive-value="0" @change="handle('enable',scope.row)"
- v-model="scope.row.status + ''">
- </el-switch>
- </template>
- </el-table-column>
- <el-table-column prop="scope" label="创建时间">
- <template slot-scope="scope">
- {{scope.row.created_at|dateTimeFormat('Y-m-d H:i:s')}}
- </template>
- </el-table-column>
- <el-table-column
- label="操作"
- min-width="180"
- align="center">
- <template slot-scope="scope">
- <el-button circle size="mini" type="text" @click="handle('edit',scope.row)">
- 编辑
- </el-button>
- <el-button circle size="mini" type="text" @click="handle('delete',scope.row)">
- 删除
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <div style="text-align: right;margin: 20px 0;">
- <el-pagination v-if="pagination" :page-size="pagination.pageSize"
- style="display: inline-block;float: right;" background @current-change="pageChange"
- layout="prev, pager, next" :total="pagination.total_count">
- </el-pagination>
- </div>
- </div>
- </el-card>
- </div>
- <script>
- const app = new Vue({
- el: '#app',
- data() {
- return {
- list: [],
- listLoading: false,
- pagination:null,
- page: 1,
- pageCount: 0,
- search: {
- name:'',
- create_time:'',
- },
- };
- },
- computed: {
- show_clear_search_btn: function() {
- return !isEmpty(this.search.name)
- || !isEmpty(this.search.create_time)
- }
- },
- methods: {
- resetSearch(){
- this.search = {
- name:'',
- create_time:'',
- }
- },
- searchs() {
- this.page = 1;
- this.getList();
- },
- pageChange(currentPage) {
- let self = this;
- self.page = currentPage; //console.log(currentPage,999999);
- self.getList();
- },
- getList() {
- let self = this;
- self.listLoading = true;
- request({
- params: {
- r: 'certificate/default/index',
- page: self.page,
- name: this.search.name,
- create_time: this.search.create_time,
- },
- method: 'get',
- }).then(e => {
- self.listLoading = false;
- self.list = e.data.data.list;
- this.pagination = e.data.data.pagination;
- this.pagination.pageSize = e.data.data.page_size;
- this.pagination.total_count = e.data.data.count;
- }).catch(e => {
- console.log(e);
- });
- },
- handle(type,data = null){
- switch (type) {
- case 'delete':// 删除
- this.$confirm('删除该条数据后不可以恢复, 是否继续?', '警告', {type: 'warning'}).then(() => {this.send({id: data.id,status:-1,type:'1'});})
- break;
- case 'enable':
- var status = 0;
- if(data.status=='0') status = 1;
- this.send({id: data.id,status: status,type:'1'});
- break;
- case 'edit':
- navigateTo({
- r: 'certificate/default/edit',
- id: data.id,
- });
- break;
- case 'add':
- navigateTo({
- r: 'certificate/default/edit',
- });
- break;
- }
- },
- send(data){
- let self = this;
- self.btnLoading = true;
- request({
- params: {
- r: 'certificate/default/edit',
- },
- method: 'post',
- data:data,
- }).then(e => {
- this.dialogAddgsVisible = false;
- this.btnLoading = false;
- if (e.data.code == 0) {
- self.$message.success(e.data.msg);
- self.getList();
- } else {
- self.$message.error(e.data.msg);
- }
- }).catch(e => {
- console.log(e);
- });
- },
- },
- mounted: function () {
- this.getList();
- }
- });
- </script>
|