From e29932c247871e8921b210e311c8ea4a57d721ce Mon Sep 17 00:00:00 2001 From: zhouwx <1175765986@qq.com> Date: 星期三, 26 二月 2025 17:29:17 +0800 Subject: [PATCH] bug修改 --- src/views/hazardousChemicals/avoidWarning/index.vue | 197 ++++++++++++++++++++++++++++++------------------ 1 files changed, 122 insertions(+), 75 deletions(-) diff --git a/src/views/hazardousChemicals/avoidWarning/index.vue b/src/views/hazardousChemicals/avoidWarning/index.vue index 9cb4d7b..0502bb2 100644 --- a/src/views/hazardousChemicals/avoidWarning/index.vue +++ b/src/views/hazardousChemicals/avoidWarning/index.vue @@ -1,120 +1,136 @@ <template> <div class="app-container"> <!-- 卡片部分--> - <div style="margin-bottom: 10px;display: flex;align-items: center;justify-content: space-between"> - <div style="font-weight: 600;font-size: 22px">实时报警状态</div> + <div style="margin-bottom: 10px;display: flex;align-items: center;justify-content: space-between" > + <div style="font-weight: 600;font-size: 20px">实时报警状态</div> <div style="display: flex;align-items: center"> - <div class="card-item-red title-font"> - <el-icon><WarnTriangleFilled /></el-icon> + <div class="title-font" style="cursor: pointer" :class="cardQueryParams.warningType == '' ? 'card-item-blue-titleChoose' : 'card-item-blue-title'" @click="chooseType('')"> + 全部 + </div> + <div class=" title-font" style="cursor: pointer" :class="cardQueryParams.warningType == 1 ? 'card-item-red-titleChoose' : 'card-item-red-title'" @click="chooseType('red')"> + <el-icon style="margin-right: 3px"><WarnTriangleFilled /></el-icon> 高危报警 </div> - <div class="card-item-yellow title-font"> - <el-icon><WarningFilled /></el-icon> + <div class=" title-font" style="cursor: pointer" :class="cardQueryParams.warningType == 2 ? 'card-item-yellow-titleChoose' : 'card-item-yellow-title'" @click="chooseType('yellow')"> + <el-icon style="margin-right: 3px"><WarningFilled /></el-icon> 中等风险 </div> </div> </div> - <el-scrollbar max-height="420px" style="padding-right: 10px;overflow-x: hidden;"> + <el-scrollbar max-height="420px" style="padding-right: 10px;overflow-x: hidden;" v-if="state.dataList && state.dataList.length >0"> <el-row :gutter="20" style="margin-top: 5px;margin-left: 5px"> <el-col v-for="(item,index) in state.dataList" :key="index" :span="8"> - <el-card class="card-item " :class= "item.level == 1 ? 'card-item-red' : 'card-item-yellow' " shadow="always">{{ item.name }}</el-card> + <el-card class="card-item " :class= "item.warningType == 1 ? 'card-item-red' : 'card-item-yellow' " shadow="always"> + <div style="display: flex;align-items: center;justify-content: space-between"> + {{item.basicName}} + <el-tag :color="item.warningType == 1 ? '#FBACAC' : '#FBD59A'" :type="item.warningType == 1 ? 'danger' : 'warning'">{{ item.warningType == 1 ? '危险' : '警告' }}</el-tag> + </div> + <div style="margin-top: 10px">相忌试剂:{{ item.tabooBasicName }}</div> + <div style="margin-top: 10px">存储位置:{{item.warehouseName}}——{{item.cupboardName}}</div> + <el-button style="margin-top: 15px;float: right;color: white;margin-bottom: 5px" :color="item.warningType == 1 ? '#ef8a8a' : '#efb965'" @click="handle(item)">立即处理</el-button> + + </el-card> </el-col> </el-row> </el-scrollbar> + <el-empty v-else></el-empty> <!-- 表格部分--> - <div style="font-weight: 600;font-size: 22px;margin-top: 25px">最近报警记录</div> + <div style="font-weight: 600;font-size: 20px;margin-top: 25px">最近报警记录</div> <div style="margin-top: 10px"> <el-table v-loading="loading" :data="state.tableList" :border="true"> <el-table-column label="序号" type="index" align="center" width="80" /> - <el-table-column label="时间" prop="name" align="center" /> - <el-table-column label="相忌试剂" prop="remark" align="center" /> - <el-table-column label="储存位置" prop="remark" align="center" /> - <el-table-column label="风险等级" prop="remark" align="center" /> - <el-table-column label="处理状态" prop="remark" align="center" /> - <el-table-column label="处理人" prop="remark" align="center" /> + <el-table-column label="时间" prop="createTime" align="center" /> + <el-table-column label="品名" prop="basicName" align="center" /> + <el-table-column label="相忌试剂" prop="tabooBasicName" align="center" /> + <el-table-column label="储存位置" align="center" > + <template #default="scope"> + <span>{{scope.row.warehouseName}}——{{scope.row.cupboardName}}</span> + </template> + </el-table-column> + <el-table-column label="风险等级" align="center" > + <template #default="scope"> + <el-tag type="danger" v-if="scope.row.warningType == 1">高危</el-tag> + <el-tag type="warning" v-else>中等</el-tag> + </template> + </el-table-column> + <el-table-column label="处理状态" align="center" > + <template #default="scope"> + <span>{{scope.row.state == 0 ? '未处理' : '已处理'}}</span> + </template> + </el-table-column> + <el-table-column label="处理人" prop="updateBy" align="center" /> </el-table> <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" - @pagination="getList" + @pagination="getListAll" /> </div> + <avoid-dialog ref="avoidRef" @getList="getListAll"></avoid-dialog> </div> </template> <script setup> -import {reactive, ref, toRefs} from "vue"; +import {onMounted, reactive, ref, toRefs} from "vue"; import {getWarehouse} from "@/api/hazardousChemicals/warehouse"; import {ElMessage} from "element-plus"; - +import avoidDialog from './components/avoidDialog.vue' +import {getAvoidInfoPage, getAvoidList} from "@/api/hazardousChemicals/avoid"; +const avoidRef = ref(null) const state = reactive({ queryParams: { pageNum: 1, pageSize: 5, - name: '' + warningType: '' + }, + cardQueryParams: { + warningType: '' }, total: 0, - dataList: [ - { - id: 1, - name: '硫酸与氢氧化钠', - address: 'S区-1号柜', - level: 1, //1-低危 2-中危 3-高危 - }, - { - id: 1, - name: '硫酸与氢氧化钠', - address: 'S区-1号柜', - level: 2, //1-低危 2-中危 3-高危 - }, - { - id: 1, - name: '硫酸与氢氧化钠', - address: 'S区-1号柜', - level: 1, //1-低危 2-中危 3-高危 - }, - { - id: 1, - name: '硫酸与氢氧化钠', - address: 'S区-1号柜', - level: 1, //1-低危 2-中危 3-高危 - }, - { - id: 1, - name: '硫酸与氢氧化钠', - address: 'S区-1号柜', - level: 2, //1-低危 2-中危 3-高危 - }, - { - id: 1, - name: '硫酸与氢氧化钠', - address: 'S区-1号柜', - level: 1, //1-低危 2-中危 3-高危 - }, - { - id: 1, - name: '硫酸与氢氧化钠', - address: 'S区-1号柜', - level: 2, //1-低危 2-中危 3-高危 - }, - - ], + dataList: [], tableList: [] }); -const { queryParams, total, dataList } = toRefs(state); +const { queryParams,cardQueryParams, total, dataList } = toRefs(state); const loading = ref(false); -const getList = async () => { +onMounted(()=>{ + getListPage() + getList() +}) +const getListPage = async () => { loading.value = true - // const res = await getWarehouse(data.queryParams) - // if(res.code == 200){ - // data.dataList = res.data.list - // data.total = res.data.total - // }else{ - // ElMessage.warning(res.message) - // } + const res = await getAvoidInfoPage(state.queryParams) + if(res.code == 200){ + state.tableList = res.data.list + state.total = res.data.total + }else{ + ElMessage.warning(res.message) + } loading.value = false +} +const getList = async () => { + const res = await getAvoidList(state.cardQueryParams) + if(res.code == 200){ + state.dataList = res.data + }else{ + ElMessage.warning(res.message) + } +} +const handle = (val) => { + avoidRef.value.openDialog(val); +} + +const chooseType = (type) => { + state.queryParams.warningType = type == 'red' ? 1 : type == '' ? '' :2 + state.cardQueryParams.warningType = type == 'red' ? 1 : type == '' ? '' :2 + getListPage() + getList() + +} +const getListAll = () => { + getListPage() + getList() } </script> @@ -122,8 +138,9 @@ <style scoped lang="scss"> .app-container{ .card-item{ - height: 180px; + //height: 160px; margin-bottom: 10px; + //min-width: 300px; } .title-font{ display:flex; @@ -134,16 +151,46 @@ border-radius: 5px } .card-item-red{ - + cursor: pointer; color: #f56c6c; background-color: rgb(254, 240.3, 240.3); border: 1px solid rgb(253, 225.6, 225.6); + } + .card-item-red-title{ + cursor: pointer; + color: #f56c6c; + background-color: rgb(254, 240.3, 240.3); + border: 1px solid rgb(253, 225.6, 225.6); + } + .card-item-red-titleChoose{ + color: #f6d1d1; + background-color: #f55d5d; } .card-item-yellow{ color: #e6a23c; background-color: rgb(252.5, 245.7, 235.5); border: 1px solid rgb(250, 236.4, 216); } + .card-item-yellow-title{ + cursor: pointer; + color: #f1950b; + background-color: rgb(252.5, 245.7, 235.5); + border: 1px solid rgb(250, 236.4, 216); + } + .card-item-yellow-titleChoose{ + color: #f6e7d1; + background-color: #f1a902; + } + .card-item-blue-title{ + cursor: pointer; + color: #409eff; + background-color: rgb(235.9, 245.3, 255); + border: 1px solid rgb(216.8, 235.6, 255); + } + .card-item-blue-titleChoose{ + color: #d7e6f6; + background-color: #2da0ef; + } :deep(.is-horizontal) { height: 0; left: 0; -- Gitblit v1.9.2