| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- @extends('layouts.base')
- @section('content')
- @section('title', '模板库管理')
- <link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-goods1.css')}}" />
- <div id="app">
- <div class="all">
- <div class="vue-head">
- <div class="vue-main-title">
- <div class="vue-main-title-left"></div>
- <div class="vue-main-title-content">模板库管理</div>
- <div class="vue-main-title-right"><el-button style="margin-top:10px;color: #FFFFFF;background-color: #29ba9c;" @click="addTemp"> <i class="el-icon-plus"></i> 添加新模板</el-button></div>
- </div>
- <div class="vue-search">
- <el-form :inline="true" :model="search" class="demo-form-inline">
- <el-form-item label="">
- <el-input v-model="search.kwd" placeholder="关键字"></el-input>
- </el-form-item>
- <el-form-item label="">
- <el-button type="primary" @click="handleSearch">搜索</el-button>
- </el-form-item>
- </el-form>
- </div>
- <el-table :data="tableData" style="width: 100%">
- <el-table-column prop="title" label="模板名称" align="center">
- </el-table-column>
- <el-table-column label="操作" align="center">
- <template slot-scope="scope">
- <i class="el-icon-edit-outline" style="font-size:18px;cursor:pointer" @click="edit(scope.row.id)"></i>
- <i class="el-icon-delete-solid" style="font-size:18px;cursor:pointer" @click="deleteTemp(scope.row.id)"></i>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div class="vue-page" >
- <el-row>
- <el-col align="right">
- <el-pagination layout="prev, pager, next,jumper" @current-change="search1" :total="total" :page-size="per_page" :current-page="current_page" background></el-pagination>
- </el-col>
- </el-row>
- </div>
- </div>
- </div>
- <script language='javascript'>
- //vue
- var app = new Vue({
- el: "#app",
- delimiters: ['[[', ']]'],
- data() {
- return {
- page: 1,
- tableData: [],
- current_page:1,
- total:1,
- per_page:15,
- search:{
- kwd:''
- }
- }
- },
- computed: {
- },
- mounted() {
- this.getTempList()
- },
- methods: {
- //获取模板列表数据
- getTempList() {
- this.$http.post("{!! yzWebFullUrl('plugin.printer.admin.temp.get-list') !!}", {
- page: this.current_page,
- kwd:this.search.kwd
- }).then(res => {
- if (res.data.result) {
- this.tableData = res.data.data.data
- this.current_page = res.data.data.current_page
- this.total=res.data.data.total
- this.per_page =res.data.data.per_page
- } else {
- this.$message.error(res.data.msg);
- }
- })
- },
- //编辑模板
- edit(id) {
- let url = "{!! yzWebUrl('plugin.printer.admin.temp.add') !!}&id=" + id
- window.location.href = url
- },
- addTemp() {
- let url = "{!! yzWebUrl('plugin.printer.admin.temp.add') !!}"
- window.location.href = url
- },
- deleteTemp(id) {
- this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this.$http.post("{!! yzWebFullUrl('plugin.printer.admin.temp.del') !!}&id=" + id, {
- temp:{id}
- }).then(res => {
- if (res.data.result) {
- this.$message.success(res.data.msg);
- this.getTempList()
- } else {
- this.$message.error(res.data.msg);
- }
- })
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消删除'
- });
- });
- },
- // 搜索
- search1(page){
- this.current_page = page
- this.getTempList(page)
- },
- handleSearch(){
- this.getTempList()
- }
- },
- })
- </script>
- @endsection
|