调整代码

This commit is contained in:
guanj
2026-07-09 15:26:01 +08:00
parent 69e6a1f93f
commit 8bca4191f2
4 changed files with 77 additions and 9 deletions

View File

@@ -70,7 +70,15 @@
</el-button> </el-button>
</template> </template>
<slot name="operation"></slot> <slot name="operation"></slot>
<el-button class="ml10" v-if="showCustomColumn" :icon="Setting" @click="openCustomColumn">列设置</el-button> <el-button
class="ml10"
v-if="showCustomColumn"
:icon="Setting"
@mousedown="onCustomColumnMousedown"
@click="openCustomColumn"
>
列设置
</el-button>
</div> </div>
<el-form <el-form
:style="showSelect && showUnfoldButton ? headerFormSecondStyleOpen : headerFormSecondStyleClose" :style="showSelect && showUnfoldButton ? headerFormSecondStyleOpen : headerFormSecondStyleClose"
@@ -167,8 +175,26 @@ watch(
}, 500) }, 500)
} }
) )
let customColumnVisibleOnPress = false
const onCustomColumnMousedown = () => {
const table = tableStore?.table?.ref as any
if (!table) return
customColumnVisibleOnPress = table.getCustomVisible?.() ?? !!table.reactData?.customStore?.visible
if (table.reactData?.customStore) {
table.reactData.customStore.activeBtn = true
}
}
const openCustomColumn = () => { const openCustomColumn = () => {
tableStore?.table?.ref?.openCustom?.() const table = tableStore?.table?.ref as any
if (!table) return
if (table.reactData?.customStore) {
table.reactData.customStore.activeBtn = false
}
if (customColumnVisibleOnPress) {
table.closeCustom?.()
} else {
table.openCustom?.()
}
} }
onMounted(() => { onMounted(() => {
if (props.showCustomColumn && tableStore?.table) { if (props.showCustomColumn && tableStore?.table) {

View File

@@ -1,7 +1,7 @@
<template> <template>
<div :style="{ height: typeof props.height === 'string' ? props.height : tableStore.table.height }"> <div :style="{ height: typeof props.height === 'string' ? props.height : tableStore.table.height }">
<div v-if="showCustomColumn && !tableStore?.table?.customColumnInHeader" class="table-custom-toolbar"> <div v-if="showCustomColumn && !tableStore?.table?.customColumnInHeader" class="table-custom-toolbar">
<el-button icon="el-icon-Setting" @click="openCustomColumn">列设置</el-button> <el-button icon="el-icon-Setting" @mousedown="onCustomColumnMousedown" @click="openCustomColumn">列设置</el-button>
</div> </div>
<vxe-table <vxe-table
ref="tableRef" ref="tableRef"
@@ -135,8 +135,26 @@ const selectChangeEvent: VxeTableEvents.CheckboxChange<any> = ({ checked }) => {
const records = (tableRef.value as VxeTableInstance).getCheckboxRecords() const records = (tableRef.value as VxeTableInstance).getCheckboxRecords()
tableStore.onTableAction('selection-change', records) tableStore.onTableAction('selection-change', records)
} }
let customColumnVisibleOnPress = false
const onCustomColumnMousedown = () => {
const table = tableRef.value as any
if (!table) return
customColumnVisibleOnPress = table.getCustomVisible?.() ?? !!table.reactData?.customStore?.visible
if (table.reactData?.customStore) {
table.reactData.customStore.activeBtn = true
}
}
const openCustomColumn = () => { const openCustomColumn = () => {
tableRef.value?.openCustom?.() const table = tableRef.value as any
if (!table) return
if (table.reactData?.customStore) {
table.reactData.customStore.activeBtn = false
}
if (customColumnVisibleOnPress) {
table.closeCustom?.()
} else {
table.openCustom?.()
}
} }
const getRef = () => { const getRef = () => {
return tableRef.value return tableRef.value

View File

@@ -24,8 +24,8 @@
</el-form-item> </el-form-item>
</template> </template>
<template #operation> <template #operation>
<el-button icon="el-icon-Plus" type="primary" @click="addFormModel">新增</el-button> <el-button icon="el-icon-Plus" type="primary" @click="addFormModel" v-if="information">新增</el-button>
<el-button icon="el-icon-Delete" type="primary" @click="deleteEven">删除</el-button> <el-button icon="el-icon-Delete" type="primary" @click="deleteEven" v-if="information">删除</el-button>
<!-- <el-button icon="el-icon-Download" type="primary" @click="exportExcelTemplate" :loading="loading"> <!-- <el-button icon="el-icon-Download" type="primary" @click="exportExcelTemplate" :loading="loading">
模板下载 模板下载
</el-button> </el-button>
@@ -59,6 +59,7 @@ import DetailInfo from './components/detail.vue'
import { cancelFormData, getUserReportById } from '@/api/supervision-boot/interfere/index' import { cancelFormData, getUserReportById } from '@/api/supervision-boot/interfere/index'
import { deleteUserReport } from '@/api/device-boot/sensitiveLoadMange' import { deleteUserReport } from '@/api/device-boot/sensitiveLoadMange'
import { download } from '@/utils/fileDownLoad' import { download } from '@/utils/fileDownLoad'
const addForms = ref() const addForms = ref()
const dictData = useDictData() const dictData = useDictData()
const sensitiveUserPopup = ref() const sensitiveUserPopup = ref()
@@ -73,6 +74,8 @@ defineOptions({
//获取登陆用户姓名和部门 //获取登陆用户姓名和部门
const adminInfo = useAdminInfo() const adminInfo = useAdminInfo()
const information = ref(adminInfo.roleCode.includes('business_manager'))
const tableStore = new TableStore({ const tableStore = new TableStore({
url: '/device-boot/userReport/getUserLedgerPage', url: '/device-boot/userReport/getUserLedgerPage',
// publicHeight: 65, // publicHeight: 65,

View File

@@ -18,8 +18,8 @@
placeholder="电站名称,终端编号,监测点名称、电压等级、终端厂家、干扰源类型" placeholder="电站名称,终端编号,监测点名称、电压等级、终端厂家、干扰源类型"
v-model="tableStore.table.params.searchValue" v-model="tableStore.table.params.searchValue"
clearable clearable
maxlength="32" maxlength="32"
show-word-limit show-word-limit
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="电压等级:"> <el-form-item label="电压等级:">
@@ -155,6 +155,20 @@ const tableStore = new TableStore({
/* { field: 'comFlag', title: '通讯状态 ', minWidth: 120 },*/ /* { field: 'comFlag', title: '通讯状态 ', minWidth: 120 },*/
{ field: 'id', title: '监测点序号', minWidth: 90 }, { field: 'id', title: '监测点序号', minWidth: 90 },
{
field: 'comFlag',
title: '通讯状态',
render: 'tag',
minWidth: 80,
custom: {
中断: 'danger',
正常: 'success'
},
replaceValue: {
中断: '中断',
正常: '正常'
}
},
{ {
field: 'runFlag', field: 'runFlag',
title: '运行状态', title: '运行状态',
@@ -166,6 +180,13 @@ const tableStore = new TableStore({
检修: 'warning', 检修: 'warning',
调试: 'warning', 调试: 'warning',
退运: 'danger' 退运: 'danger'
},
replaceValue: {
投运: '投运',
停运: '停运',
检修: '检修',
调试: '调试',
退运: '退运'
} }
}, },
{ field: 'devName', title: '监测终端编号 ', minWidth: 140 }, { field: 'devName', title: '监测终端编号 ', minWidth: 140 },