<template> <app-container> <search-area class="searchBottom" :need-clear="false" :need-search-more="false" type="seperate" size="small" search-more-type="default" @search="fetchData" > <!--一般查询条件--> <search-item> <el-input v-model="listQuery.tenantName" placeholder="项目名称" clearable /> </search-item> </search-area> <normal-table ref="normalTable" :data="list" :query="listQuery" :columns="columns" :list-loading="listLoading" :options="options" size="small" > <template slot="btns"> <el-button size="small" @click="add"> 新增 </el-button> </template> <template slot="columns"> <el-table-column label="操作" width="120" align="center"> <template slot-scope="scope"> <el-button type="text" size="small" @click="edit(scope.row)"> 修改 </el-button> <el-button type="text" size="small" @click="del(scope.row)"> 删除 </el-button> <el-button type="text" size="small" @click="detail(scope.row)"> 详情 </el-button> </template> </el-table-column> </template> </normal-table> <dialog-alarm-content ref="dialogAlarmContent" @watchChild="fetchData" /> </app-container> </template> <script> import dialogAlarmContent from '@/views/systemConfig/tenantConfig/components/dialogListTenant' import { alarmTenantList, delAlarmTenant } from '@/api/systemConfig/tenantConfig' export default { name: 'ListTenant', components: { dialogAlarmContent }, data() { return { // 查询条件 listQuery: { tenantName: '', offset: 1, sort: 'id', order: 'asc' }, columns: [ { text: '编号', value: 'tenentId', align: 'center' }, { text: '项目名称', value: 'tenantName', align: 'center' }, { text: '支持通讯协议', value: 'communication', align: 'center' }, { text: '导入数据默认坐标系', value: 'coordinateType', align: 'center' }, { text: '是否需要生成工单', value: 'isJobGenerate', align: 'center' }, { text: '是否开启APP推送', value: 'isAppPush', align: 'center' }, { text: '是否开启短信推送', value: 'isMessagePush', align: 'center' }, { text: '报警推送规则', value: 'alarmPushType', align: 'center' } ], // 显示列 listLoading: false, deviceModelList: [], // 设备类型列表 list: [], // 表格数据列表 // 是否需要序号列 options: { needIndex: false } } }, created() { this.fetchData() }, mounted() { this.$refs.normalTable.initColumnsState(false) }, methods: { // 获取数据列表 fetchData() { this.listLoading = true alarmTenantList(this.listQuery).then(response => { this.list = response.data this.listLoading = false }) }, del(row) { this.$confirm( '确定要删除所选设备吗?', '确认操作', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' } ).then(() => { delAlarmTenant(row.id).then(response => { if (response.code === 200) { this.$message.success('删除成功') this.fetchData() } }) }).catch(() => { this.$message({ type: 'info', message: '已取消删除' }) }) }, // 新增 add() { this.$refs.dialogAlarmContent.initDialog('create') }, // 修改 edit(row) { this.$refs.dialogAlarmContent.initDialog('update', row) }, // 详情 detail(row) { this.$refs.dialogAlarmContent.initDialog('detail', row) } } } </script> <style rel="stylesheet/scss" lang="scss" scoped> .searchBottom{ border-bottom: 12px solid #ebebeb; } </style>