bztang-admin/plugins/new-poster/views/admin/label-list.blade.php

137 lines
5.8 KiB
PHP

@extends('layouts.base')
@section('title', "标签管理")
@section('content')
<link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-goods1.css')}}"/>
<div class="all">
<div id="app" v-cloak>
<div class="vue-head">
<div class="vue-main-title" style="margin-bottom:20px">
<div class="vue-main-title-left"></div>
<div class="vue-main-title-content">标签管理</div>
<el-button type="primary" plain icon="el-icon-plus" @click="add">添加标签</el-button>
</div>
<div class="vue-search">
<div style="display: flex;flex-wrap: wrap">
<el-form :inline="true" :model="search_form" class="demo-form-inline">
<el-form-item label="">
<el-input v-model="search_form.name" placeholder="名称"></el-input>
</el-form-item>
<el-form-item label="" style="float: right">
<el-button type="primary" @click="search(1)">搜索</el-button>
</el-form-item>
</el-form>
</div>
</div>
</div>
<div class="vue-main">
<div class="vue-main-form">
<div class="vue-main-title" style="margin-bottom:20px">
<div class="vue-main-title-left"></div>
<div class="vue-main-title-content">标签列表</div>
</div>
<el-table :data="data_list" style="width: 100%">
<el-table-column label="ID" align="center" prop="id" width="auto"></el-table-column>
<el-table-column label="标签名称" align="center" prop="name" width="auto"></el-table-column>
<el-table-column prop="" label="操作" align="center" width="auto">
<template slot-scope="scope">
<el-link icon="el-icon-edit" @click="edit(scope.row.id)"></el-link>
<el-link icon="el-icon-delete" @click="del(scope.row.id)"></el-link>
</template>
</el-table-column>
</el-table>
</div>
</div>
<!-- 分页 -->
<div class="vue-page" >
<el-row>
<el-col align="right">
<el-pagination layout="prev, pager, next,jumper" @current-change="search" :total="total"
:page-size="per_page" :current-page="current_page" background
></el-pagination>
</el-col>
</el-row>
</div>
</div>
</div>
<script>
var app = new Vue({
el: "#app",
delimiters: ['[[', ']]'],
data() {
return {
data_list: [],
search_form: {
name: "",
},
current_page: 1,
total: 1,
per_page: 1,
}
},
created() {
},
mounted() {
this.getData(1);
},
methods: {
getData(page) {
let json = {
page: page,
search: {
name:this.search_form.name,
},
};
let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
this.$http.post('{!! yzWebFullUrl('plugin.new-poster.admin.poster.labelSearch') !!}',json).then(function(response) {
if (response.data.result) {
let list = response.data.data.list;
this.data_list = list.data;
this.current_page = list.current_page;
this.total = list.total;
this.per_page = list.per_page;
loading.close();
} else {
this.$message({message: response.data.msg, type: 'error'});
}
loading.close();
}, function(response) {
this.$message({message: response.data.msg, type: 'error'});
loading.close();
});
},
search(val) {
this.getData(val);
},
add(){
let url = '{!! yzWebFullUrl('plugin.new-poster.admin.poster.labelAdd') !!}';
window.location.href = url;
},
edit(id){
let url = '{!! yzWebFullUrl('plugin.new-poster.admin.poster.labelEdit') !!}' + '&id='+id;
window.location.href = url;
},
del(id){
this.$confirm('是否确定删除?', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'}).then(() => {
let json = {
id: id,
};
this.$http.post('{!! yzWebFullUrl('plugin.new-poster.admin.poster.delLabel') !!}',json).then(function(response) {
if (response.data.result) {
this.$message({message: response.data.msg, type: 'success'});
window.location.reload();
} else {
this.$message({message: response.data.msg, type: 'error'});
}
}, function(response) {
this.$message({message: response.data.msg, type: 'error'});
});
}).catch(() => {
this.$message({type: 'info', message: '取消删除'});
});
},
},
})
</script>
@endsection