bztang-admin/plugins/printer/views/admin/printer_list.blade.php

163 lines
6.0 KiB
PHP

@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="id" label="ID" align="center">
</el-table-column>
<el-table-column prop="title" label="打印机名称" align="center">
</el-table-column>
<el-table-column label="状态" align="center">
<template slot-scope="scope">
<el-switch
v-model="scope.row.status"
active-color="#29ba9c"
inactive-color="#dcdfe6"
:active-value="1"
:inactive-value="0"
@change="change(scope.row)"
>
</el-switch>
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<i class="el-icon-edit-outline" style="cursor:pointer;font-size:18px;cursor:pointer" @click="edit(scope.row.id)"></i>
<i class="el-icon-delete-solid" style="cursor:pointer;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 {
search:{
kwd:''
},
page: 1,
tableData: [],
current_page:1,
total:1,
per_page:15
}
},
computed: {
},
mounted() {
this.getPrinterList()
},
methods: {
//开启或关闭打印机
change(item){
this.$http.post("{!! yzWebFullUrl('plugin.printer.admin.list.edit') !!}", {
printer: {
id:item.id,
title: item.title,
user: item.user,
ukey: item.ukey,
printer_sn: item.printer_sn,
times: item.times,
status : item.status,
}
}).then((res) => {
if (res.data.result) {
this.$message.success(res.data.msg)
this.getPrinterList()
} else {
this.$message.error(res.data.msg);
}
})
},
//获取模板列表数据
getPrinterList() {
this.$http.post("{!! yzWebFullUrl('plugin.printer.admin.list.get-list') !!}", {
page: this.current_page,
kwd:this.search.kwd
}).then(res => {
if (res.data.result) {
this.tableData = res.data.data.data
} else {
this.$message.error(res.data.msg);
}
})
},
//编辑模板
edit(id) {
let url = "{!! yzWebUrl('plugin.printer.admin.list.add') !!}&id=" + id
window.location.href = url
},
addTemp() {
let url = "{!! yzWebUrl('plugin.printer.admin.list.add') !!}"
window.location.href = url
},
deleteTemp(id) {
this.$confirm('此操作将永久删除, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http.post("{!! yzWebFullUrl('plugin.printer.admin.list.del') !!}&id=" + id, {
printer:{
id
}
}).then(res => {
if (res.data.result) {
this.$message.success(res.data.msg);
this.getPrinterList()
} else {
this.$message.error(res.data.msg);
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
},
search1(page){
this.current_page = page
this.getPrinterList()
},
handleSearch(){
this.getPrinterList()
}
},
})
</script>
@endsection