From 3a154bdb0a5aaa2c0ac3eac95a6ba747068bd454 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期二, 13 一月 2026 10:00:37 +0800
Subject: [PATCH] 优化
---
admin/src/views/business/warningRule.vue | 139 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 139 insertions(+), 0 deletions(-)
diff --git a/admin/src/views/business/warningRule.vue b/admin/src/views/business/warningRule.vue
new file mode 100644
index 0000000..7773aaf
--- /dev/null
+++ b/admin/src/views/business/warningRule.vue
@@ -0,0 +1,139 @@
+<template>
+ <TableLayout :permissions="['business:warningrule:query']">
+ <!-- 鎼滅储琛ㄥ崟 -->
+ <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
+ <el-form-item label="鎶ヨ瑙勫垯" prop="info">
+ <el-input v-model="searchForm.title" placeholder="璇疯緭鍏ユ姤璀﹁鍒�" clearable @keypress.enter.native="search"></el-input>
+ </el-form-item>
+ <el-form-item label="浜哄憳/閮ㄩ棬" prop="memberNames">
+ <el-input v-model="searchForm.memberNames" placeholder="璇疯緭鍏ヤ汉鍛樻垨閮ㄩ棬鍚�" clearable @keypress.enter.native="search"></el-input>
+ </el-form-item>
+ <el-form-item label="骞挎挱鍚嶇О" prop="memberNames">
+ <el-input v-model="searchForm.deviceNames" placeholder="璇疯緭鍏ュ箍鎾悕绉�" clearable @keypress.enter.native="search"></el-input>
+ </el-form-item>
+ <el-form-item label="鐘舵��" prop="status" >
+ <el-select v-model="searchForm.status" placeholder="璇烽�夋嫨鐘舵��" clearable @change="search">
+ <el-option label="绂佺敤" value="0"></el-option>
+ <el-option label="鍚敤" value="1"></el-option>
+ </el-select>
+ </el-form-item>
+ <section>
+ <el-button type="primary" @click="search">鎼滅储</el-button>
+ <el-button @click="reset">閲嶇疆</el-button>
+ </section>
+ </el-form>
+ <!-- 琛ㄦ牸鍜屽垎椤� -->
+ <template v-slot:table-wrap>
+ <ul class="toolbar" v-permissions="['business:warningrule:create', 'business:warningrule:delete']">
+ <li><el-button type="primary" @click="$refs.operaWarningRuleWindow.open('鏂板缓鎶ヨ瑙勫垯閰嶇疆')" icon="el-icon-plus" v-permissions="['business:warningrule:create']">鏂板缓</el-button></li>
+ <li><el-button @click="deleteByIdInBatch" type="danger" icon="el-icon-delete" v-permissions="['business:warningrule:delete']">鍒犻櫎</el-button></li>
+ </ul>
+ <el-table
+ :height="tableHeightNew"
+ v-loading="isWorking.search"
+ :data="tableData.list"
+ stripe
+ @selection-change="handleSelectionChange"
+ >
+ <el-table-column type="selection" width="55"></el-table-column>
+ <el-table-column prop="title" label="鎶ヨ瑙勫垯" min-width="200px" show-tooltip-when-overflow></el-table-column>
+ <el-table-column prop="detailList" label="瑙勫垯鏄庣粏" min-width="360px" show-tooltip-when-overflow>
+ <template slot-scope="{row}">
+ <div v-if="row.detailList && row.detailList.length">
+ <div style="display: block;" v-for="item in row.detailList"> {{item.warningName||''}} {{item.regionName||''}} {{item.deviceName||''}};</div>
+ </div>
+ </template>
+ </el-table-column>
+ <el-table-column prop="memberNames" label="鎶ヨ鎺ユ敹浜�" min-width="200px" show-tooltip-when-overflow>
+ <template slot-scope="{row}">
+ <span v-if="row.memberNotice === 1">{{row.memberNames}}</span>
+ <span v-else class="red">鏈紑鍚�</span>
+ </template>
+ </el-table-column>
+ <el-table-column prop="deviceNames" label="鎶ヨ鎾姤骞挎挱" min-width="200px" show-tooltip-when-overflow>
+ <template slot-scope="{row}">
+ <span v-if="row.deviceNotice === 1">{{row.deviceNames}}</span>
+ <span v-else class="red">鏈紑鍚�</span>
+ </template>
+ </el-table-column>
+ <el-table-column prop="intervalSec" label="闂撮殧鏃堕棿(绉掞級" min-width="100px" ></el-table-column>
+ <el-table-column prop="status" label="鐘舵��" min-width="100px" >
+ <template slot-scope="{row}">
+ <el-switch @change="changeStatus($event, row)" v-model="row.status" active-color="#13ce66"
+ inactive-color="#ff4949" :active-value="1" :inactive-value="0" >
+ </el-switch>
+ </template>
+ </el-table-column>
+ <el-table-column prop="editDate" label="鏇存柊鏃堕棿" min-width="150px"></el-table-column>
+ <el-table-column
+ v-if="containPermissions(['business:warningrule:update', 'business:warningrule:delete'])"
+ label="鎿嶄綔"
+ min-width="120"
+ fixed="right"
+ >
+ <template slot-scope="{row}">
+ <el-button type="text" @click="$refs.operaWarningRuleWindow.open('缂栬緫鎶ヨ瑙勫垯閰嶇疆', row)" icon="el-icon-edit" v-permissions="['business:warningrule:update']">缂栬緫</el-button>
+ <el-button type="text" @click="deleteById(row)" icon="el-icon-delete" style="color: red" v-permissions="['business:warningrule:delete']">鍒犻櫎</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ <pagination
+ @size-change="handleSizeChange"
+ @current-change="handlePageChange"
+ :pagination="tableData.pagination"
+ >
+ </pagination>
+ </template>
+ <!-- 鏂板缓/淇敼 -->
+ <OperaWarningRuleWindow ref="operaWarningRuleWindow" @success="handlePageChange"/>
+ </TableLayout>
+</template>
+
+<script>
+import BaseTable from '@/components/base/BaseTable'
+import TableLayout from '@/layouts/TableLayout'
+import Pagination from '@/components/common/Pagination'
+import OperaWarningRuleWindow from '@/components/business/OperaWarningRuleWindow'
+export default {
+ name: 'WarningRule',
+ extends: BaseTable,
+ components: { TableLayout, Pagination, OperaWarningRuleWindow },
+ data () {
+ return {
+ // 鎼滅储
+ searchForm: {
+ title: '',
+ memberNames: '',
+ deviceNames: '',
+ status:'',
+ }
+ }
+ },
+ created () {
+ this.config({
+ module: '鎶ヨ瑙勫垯閰嶇疆',
+ api: '/business/warningRule',
+ 'field.id': 'id',
+ 'field.main': 'id'
+ })
+ this.search()
+ },
+ methods: {
+ changeStatus (e, row) {
+ this.working = true
+ this.api.updateStatus({ id: row.id, status: e })
+ .then(res => {
+ this.$tip.apiSuccess(res || '鎿嶄綔鎴愬姛')
+ this.search()
+ })
+ .catch(e => {
+ this.$tip.apiFailed(e)
+ })
+ .finally(() => {
+ this.working = false
+ })
+ .catch(() => { })
+ }
+ }
+}
+</script>
--
Gitblit v1.9.3