From 3202b28d73a754ae65ca0acb28f32eda495aa2a2 Mon Sep 17 00:00:00 2001 From: kun <1422840143@qq.com> Date: Mon, 28 Aug 2023 18:58:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20BUG=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ProTable/index.vue | 1 + .../towerCraneSupervision/operatingData/index.scss | 1 + .../towerCraneSupervision/operatingData/index.vue | 6 +++--- src/views/project/hoistingMachineryRecord/index.scss | 10 ++++++++++ src/views/project/hoistingMachineryRecord/index.vue | 9 +++++++++ .../towerCraneSupervision/operatingData/index.scss | 1 - 6 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/components/ProTable/index.vue b/src/components/ProTable/index.vue index 60946ff..55059af 100644 --- a/src/components/ProTable/index.vue +++ b/src/components/ProTable/index.vue @@ -119,6 +119,7 @@ interface ProTableProps extends Partial, "data">> { columns: ColumnProps[]; // 列配置项 requestApi: (params: any) => Promise; // 请求表格数据的api ==> 必传 dataCallback?: (data: any) => any; // 返回数据的回调函数,可以对数据进行处理 ==> 非必传 + tableRowClassName: (data: any, dataIndex: number) => any; // 带状态、不同颜色行 ==> 非必传 title?: string; // 表格标题,目前只在打印的时候用到 ==> 非必传 pagination?: boolean; // 是否需要分页组件 ==> 非必传(默认为true) initParam?: any; // 初始化请求参数 ==> 非必传(默认为{}) diff --git a/src/views/goverment/towerCraneSupervision/operatingData/index.scss b/src/views/goverment/towerCraneSupervision/operatingData/index.scss index fb8cf8c..f218e4e 100644 --- a/src/views/goverment/towerCraneSupervision/operatingData/index.scss +++ b/src/views/goverment/towerCraneSupervision/operatingData/index.scss @@ -188,6 +188,7 @@ @include flex; flex-direction: column; align-items: center; + cursor: pointer; > div { position: relative; img { diff --git a/src/views/goverment/towerCraneSupervision/operatingData/index.vue b/src/views/goverment/towerCraneSupervision/operatingData/index.vue index 3a7336b..d97c5c5 100644 --- a/src/views/goverment/towerCraneSupervision/operatingData/index.vue +++ b/src/views/goverment/towerCraneSupervision/operatingData/index.vue @@ -391,7 +391,7 @@ function parse(val) { // 页面的项目名称和工程名称的div点击事件 const onSearch = async (params: any) => { console.log(params); - active.value === 0 ? (searchSn.value = params.projectSn) : (searchSn.value = params.engineeringSn); + alarmActive.value === 0 ? (searchSn.value = params.projectSn) : (searchSn.value = params.engineeringSn); getEquipList(); if (active.value === 0) { getAlarmList(); @@ -402,7 +402,7 @@ const onSearch = async (params: any) => { // leftMenu页面的搜索按钮 const onSearchInput = async (params: string) => { leftMenuSearchForm.value.name = params; - if (active.value === 0) { + if (alarmActive.value === 0) { getProPage(); } else { getEngPage(); @@ -411,7 +411,7 @@ const onSearchInput = async (params: string) => { // leftMenu页面的分页 const onCurChange = async (params: number) => { alarmPages.value.pageSize = params; - if (active.value === 0) { + if (alarmActive.value === 0) { getProPage(); } else { getEngPage(); diff --git a/src/views/project/hoistingMachineryRecord/index.scss b/src/views/project/hoistingMachineryRecord/index.scss index 5030cce..734cebf 100644 --- a/src/views/project/hoistingMachineryRecord/index.scss +++ b/src/views/project/hoistingMachineryRecord/index.scss @@ -33,3 +33,13 @@ } } } +.el-table .warning-row, +.el-table .warning-row .el-table-fixed-column--right, +.el-table .warning-row .el-table-fixed-column--left { + background-color: var(--el-color-warning-light-9); +} +.el-table .success-row, +.el-table .success-row .el-table-fixed-column--right, +.el-table .success-row .el-table-fixed-column--left { + background-color: var(--el-color-success-light-9); +} diff --git a/src/views/project/hoistingMachineryRecord/index.vue b/src/views/project/hoistingMachineryRecord/index.vue index 86eca01..1ffea67 100644 --- a/src/views/project/hoistingMachineryRecord/index.vue +++ b/src/views/project/hoistingMachineryRecord/index.vue @@ -6,6 +6,7 @@ :columns="columns" :requestApi="getTableList" :dataCallback="dataCallback" + :row-class-name="tableRowClassName" :tool-button="false" :pagination="true" background @@ -339,6 +340,7 @@ import { } from "@/api/modules/project"; import { GlobalStore } from "@/stores"; import { Delete } from "@element-plus/icons-vue"; +import { User } from "@/api/interface"; const baseUrl = import.meta.env.VITE_API_URL; const typeList = ref([ { label: "尖头塔", value: 1 }, @@ -671,6 +673,13 @@ const handleDeleteItem = async (params: jxj_User.ResUserList) => { await useHandleData(towerCraneEquipDel, { id: params.id }, `删除【${params.devName}】`); proTable.value.getTableList(); }; +// 处理不同状态行不同颜色 +const tableRowClassName = ({ rowIndex }: { row: User.ResUserList; rowIndex: number }) => { + console.log(rowIndex); + if (rowIndex === 0) return "warning-row"; + if (rowIndex === 6) return "success-row"; + return ""; +}; // dataCallback 是对于返回的表格数据做处理,如果你后台返回的数据不是 list && total && pageNum && pageSize 这些字段,那么你可以在这里进行处理成这些字段 // 或者直接去 hooks/useTable.ts 文件中把字段改为你后端对应的就行 const dataCallback = (data: any) => { diff --git a/src/views/project/towerCraneSupervision/operatingData/index.scss b/src/views/project/towerCraneSupervision/operatingData/index.scss index 489fbc0..265770b 100644 --- a/src/views/project/towerCraneSupervision/operatingData/index.scss +++ b/src/views/project/towerCraneSupervision/operatingData/index.scss @@ -129,7 +129,6 @@ .monitor-state { @include flex; flex-direction: column; - align-items: center; cursor: pointer; > div { position: relative;