|
|
@@ -0,0 +1,289 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <div class="right-top">
|
|
|
+ <img src="../../assets/home.png" alt="" />
|
|
|
+ <span>解封/</span>
|
|
|
+ <span class="info">解封</span>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <el-card>
|
|
|
+ <div class="right-bottom-inp">
|
|
|
+
|
|
|
+ <div class="inp">
|
|
|
+ <label for="inp2" style="background-color: #dcdfe6">编号</label>
|
|
|
+ <el-input
|
|
|
+ size="mini"
|
|
|
+ suffix-icon="el-icon-search"
|
|
|
+ type="text"
|
|
|
+ id="inp2"
|
|
|
+ placeholder="请输入设备编号"
|
|
|
+ v-model="inp2"
|
|
|
+ autocomplete="off"
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="btn">
|
|
|
+ <el-button size="mini" @click="handleReset">重置</el-button>
|
|
|
+ <el-button size="mini" type="primary" @click="handleSearchs">查询</el-button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 表格部分 -->
|
|
|
+ <!-- 内容区域 -->
|
|
|
+ <div class="table-container">
|
|
|
+ <el-table ref="multipleTable" :data="list" style="width: 100%">
|
|
|
+ <el-table-column label="序号" width="100" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.$index + 1 + (page - 1) * page_size }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="设备名称" width="100" align="center">
|
|
|
+ <template slot-scope="scope">{{ scope.row.device_name }}</template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="设备编号" width="200" align="center">
|
|
|
+ <template slot-scope="scope">{{ scope.row.device_id }}</template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="拍照数量" width="100" align="center">
|
|
|
+ <template slot-scope="scope">{{ scope.row.photo_num }}</template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="描述信息" width="800" align="center">
|
|
|
+ <template slot-scope="scope">{{ scope.row.msg_info }}</template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="封禁时间" width="200" align="center">
|
|
|
+ <template slot-scope="scope">{{ scope.row.create_time }}</template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="操作" width="150" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="success"
|
|
|
+ @click="handleBan(scope.$index, scope.row)"
|
|
|
+ >解封</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 分页区域 -->
|
|
|
+ <div class="pagination-container">
|
|
|
+ <el-pagination
|
|
|
+ background
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
+ :page-size="page_size"
|
|
|
+ :current-page="page"
|
|
|
+ layout="prev, pager, next,jumper"
|
|
|
+ :total="total"
|
|
|
+ >
|
|
|
+ </el-pagination>
|
|
|
+ </div>
|
|
|
+ </el-card>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: 'BanManage',
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ // listQuery: Object.assign({}, defaultListQuery),
|
|
|
+ inp1: '',
|
|
|
+ inp2: '',
|
|
|
+ list: [], // 表格的数据源
|
|
|
+ page: 1, // 当前是第几页
|
|
|
+ page_size: 10, // 每页显示多少条数据
|
|
|
+ total: null, // 数据总条数,
|
|
|
+ device_name: '', // 设备名称
|
|
|
+ device_id: '', // 设备id
|
|
|
+ photo_num: '', // 拍照数量
|
|
|
+ msg_info: '', // 描述信息
|
|
|
+ create_time: ''// 封禁时间
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created () {},
|
|
|
+ mounted () {
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ async getList () {
|
|
|
+ const response = await this.$axios(`/api/photo/?page=${this.page}&size=10`, 'GET')
|
|
|
+ // console.log(response);
|
|
|
+ if (response.code === 0) {
|
|
|
+ this.page_size = 10
|
|
|
+ this.list = response.result.data
|
|
|
+ this.total = response.result.paging.total
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 解封操作
|
|
|
+ handleBan (index, row) {
|
|
|
+ this.$confirm(`确定解封 ${row.device_id} 吗?`, '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ // 点击确定的操作(调用接口)
|
|
|
+ this.$axios('/api/photo/', 'POST', {
|
|
|
+ device_id: row.device_id
|
|
|
+ }).then((data) => {
|
|
|
+ // console.log(data);
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '已解封'
|
|
|
+ })
|
|
|
+ // 解封之后在刷新页面
|
|
|
+ this.getList()
|
|
|
+ })
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ // 点取消的提示
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '已取消解封'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleSearchs () {
|
|
|
+ this.page = 1
|
|
|
+ this.handleSearch()
|
|
|
+ },
|
|
|
+ // 查询
|
|
|
+ handleSearch () {
|
|
|
+ // this.page = 1
|
|
|
+
|
|
|
+ this.$axios(`/api/photo/?device_id=${this.inp2}&page=${this.page}&size=10`, 'GET').then((res) => {
|
|
|
+ console.log(res)
|
|
|
+ this.list = []
|
|
|
+ this.list = res.result.data
|
|
|
+ this.total = res.result.paging.total
|
|
|
+ console.log(this.inp2)
|
|
|
+ this.device_id = this.inp2
|
|
|
+ this.inp2 = this.device_id
|
|
|
+ console.log(this.device_id)
|
|
|
+ }).catch((err) => {
|
|
|
+ console.log(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 重置
|
|
|
+ handleReset () {
|
|
|
+ this.inp2 = ''
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+
|
|
|
+ handleCurrentChange (val) {
|
|
|
+ // 当前页改变的时候触发
|
|
|
+ console.log(this.inp2)
|
|
|
+
|
|
|
+ this.inp2 = this.inp2.trim()
|
|
|
+ if (this.inp2 === '') {
|
|
|
+ this.page = val
|
|
|
+ console.log('getlist')
|
|
|
+ this.getList()
|
|
|
+ } else {
|
|
|
+ console.log('search')
|
|
|
+ console.log(this.device_id)
|
|
|
+ this.inp2 = this.device_id
|
|
|
+ this.page = val
|
|
|
+ this.handleSearch()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped lang="less">
|
|
|
+.right-top {
|
|
|
+ // width: 100%;
|
|
|
+ // width: calc(100vw - 146px);
|
|
|
+ background-color: rgb(240, 242, 245);
|
|
|
+
|
|
|
+ min-width: 1185px;
|
|
|
+ height: 50px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ font-size: 16px;
|
|
|
+ color: #1a2a35;
|
|
|
+ > img {
|
|
|
+ margin-left: 12px;
|
|
|
+ margin-right: 12px;
|
|
|
+ }
|
|
|
+ .info {
|
|
|
+ color: #3eb984;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.right-bottom-inp {
|
|
|
+ display: flex;
|
|
|
+
|
|
|
+ .inp:nth-child(2) {
|
|
|
+ margin-left: 6px;
|
|
|
+ }
|
|
|
+ .inp {
|
|
|
+ width: 260px;
|
|
|
+ height: 28px;
|
|
|
+ font-size: 13px;
|
|
|
+ border-radius: 3px;
|
|
|
+ font-weight: 500;
|
|
|
+ color: #909399;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ margin-left: 22px;
|
|
|
+ label {
|
|
|
+ display: inline-block;
|
|
|
+ box-sizing: border-box;
|
|
|
+ width: 88px;
|
|
|
+ height: 28px;
|
|
|
+ line-height: 28px;
|
|
|
+ text-align: center;
|
|
|
+ border: 1px solid #dcdfe6;
|
|
|
+ border-radius: 3px 0px 0px 3px;
|
|
|
+ border-right: none;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.el-pagination {
|
|
|
+ text-align: center;
|
|
|
+ margin-top: 20px;
|
|
|
+}
|
|
|
+::v-deep {
|
|
|
+ .el-pagination.is-background .el-pager li:not(.disabled).active {
|
|
|
+ background-color: green;
|
|
|
+ color: #fff;
|
|
|
+ }
|
|
|
+ .el-input__inner {
|
|
|
+ border-radius: 0px !important;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.el-card {
|
|
|
+ // border: 1px solid red;
|
|
|
+ // height: 800px;
|
|
|
+ width: 93vw;
|
|
|
+ margin: 0 auto;
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+.table-container {
|
|
|
+ // border: 1px solid red;
|
|
|
+ height:680px;
|
|
|
+}
|
|
|
+
|
|
|
+.btn {
|
|
|
+ // border: 1px solid red;
|
|
|
+ margin-left: 10px;
|
|
|
+}
|
|
|
+
|
|
|
+</style>
|