185 lines
5.1 KiB
Vue

<template>
<div class="app-container">
<el-form v-show="showSearch" ref="queryForm" :inline="true" :model="queryParams" label-width="90px" size="small">
<el-form-item label="白名单信息" prop="phoneNumber">
<el-input
v-model="queryParams.equepId"
clearable
placeholder="请输入设备号"
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button icon="el-icon-search" size="mini" type="primary" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
v-hasPermi="['system:config:delete']"
:disabled="multiple"
icon="el-icon-plus"
plain
size="mini"
type="info"
@click="handleDelete"
>批量删除
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="dataList" @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="55"/>
<el-table-column align="center" label="设备号" prop="configId"/>
<el-table-column :show-overflow-tooltip="true" align="center" label="添加时间" prop="configName"/>
<el-table-column :show-overflow-tooltip="true" align="center" label="备注" prop="configValue"/>
<el-table-column align="center" class-name="small-padding fixed-width" label="操作" width="250">
<template slot-scope="scope">
<el-button
v-hasPermi="['system:config:edit']"
icon="el-icon-edit"
size="mini"
type="text"
@click="handleEdit(scope.row)"
>编辑
</el-button>
<el-button
v-hasPermi="['system:config:delete']"
icon="el-icon-delete"
size="mini"
type="text"
@click="handleDelete(scope.row)"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:limit.sync="queryParams.pageSize"
:page.sync="queryParams.pageNum"
:total="total"
@pagination="getList"
/>
<EditWhiteList :visible.sync="editWhiteListOpen" @close="closeEditWhiteList"/>
</div>
</template>
<script>
import { delConfig, listConfig } from '@/api/system/config'
import EditWhiteList from './components/editWhiteList.vue'
export default {
name: 'WhiteListEquepDetail',
dicts: ['sys_yes_no'],
components: {
EditWhiteList
},
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 参数表格数据
dataList: [],
configList: [],
// 弹出层标题
title: '',
// 是否显示编辑详情弹窗
editWhiteListOpen: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
equepId: undefined
},
// 表单参数
form: {}
}
},
created() {
this.getList()
},
methods: {
/** 查询参数列表 */
getList() {
this.loading = true
listConfig(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.dataList = response.rows
this.total = response.total
this.loading = false
}
)
},
// 表单重置
reset() {
this.form = {
equepId: undefined
}
this.resetForm('form')
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = []
this.resetForm('queryForm')
this.handleQuery()
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.configId)
this.single = selection.length != 1
this.multiple = !selection.length
},
/** 删除按钮操作 */
handleDelete(row) {
const configIds = row.configId || this.ids
this.$modal.confirm('是否确认删除编号为"' + configIds + '"的数据项?').then(function() {
return delConfig(configIds)
}).then(() => {
this.getList()
this.$modal.msgSuccess('删除成功')
}).catch(() => {
})
},
/** 修改按钮操作 */
handleEdit(row) {
this.reset()
const configId = row.configId || this.ids
this.editWhiteListOpen = true
// getConfig(configId).then(response => {
// this.form = response.data
// this.editWhiteListOpen = true
// })
},
/** 关闭新增弹出框*/
closeEditWhiteList() {
this.editWhiteListOpen = false
this.getList()
}
}
}
</script>