修改列设置点击问题

This commit is contained in:
guanj
2026-07-10 08:55:28 +08:00
parent e6313ca8c3
commit 0e70182c89
11 changed files with 451 additions and 434 deletions

View File

@@ -26,8 +26,8 @@
</el-form> </el-form>
<template v-if="$slots.select || datePicker || showSearch"> <template v-if="$slots.select || datePicker || showSearch">
<el-button type="primary" @click="showSelectChange" v-if="showUnfoldButton"> <el-button type="primary" @click="showSelectChange" v-if="showUnfoldButton">
<Icon size="14" name="el-icon-ArrowUp" style="color: #fff" v-if="showSelect" /> <Icon :size="14" name="el-icon-ArrowUp" style="color: #fff" v-if="showSelect" />
<Icon size="14" name="el-icon-ArrowDown" style="color: #fff" v-else /> <Icon :size="14" name="el-icon-ArrowDown" style="color: #fff" v-else />
</el-button> </el-button>
<el-button <el-button
@click="onComSearch" @click="onComSearch"
@@ -57,7 +57,14 @@
</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 vxe-toolbar-custom-target"
v-if="showCustomColumn"
:icon="Setting"
@click="openCustomColumn"
>
列设置
</el-button>
</div> </div>
<el-form <el-form
:style="showSelect && showUnfoldButton ? headerFormSecondStyleOpen : headerFormSecondStyleClose" :style="showSelect && showUnfoldButton ? headerFormSecondStyleOpen : headerFormSecondStyleClose"
@@ -125,7 +132,13 @@ const props = withDefaults(defineProps<Props>(), {
}) })
const openCustomColumn = () => { const openCustomColumn = () => {
tableStore?.table?.ref?.openCustom?.() const tableRef = tableStore?.table?.ref
if (!tableRef) return
if (tableRef.getCustomVisible?.()) {
tableRef.closeCustom?.()
} else {
tableRef.openCustom?.()
}
} }
// 处理 DatePicker 值变化事件 // 处理 DatePicker 值变化事件

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="Setting" @click="openCustomColumn">列设置</el-button> <el-button class="vxe-toolbar-custom-target" :icon="Setting" @click="openCustomColumn">列设置</el-button>
</div> </div>
<vxe-table <vxe-table
ref="tableRef" ref="tableRef"
@@ -66,7 +66,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, inject, computed, onMounted, watch, useAttrs } from 'vue' import { ref, inject, computed, onMounted, watch, useAttrs } from 'vue'
import type { ElTable } from 'element-plus'
import { VxeTableEvents, VxeTableInstance } from 'vxe-table' import { VxeTableEvents, VxeTableInstance } from 'vxe-table'
import { Setting } from '@element-plus/icons-vue' import { Setting } from '@element-plus/icons-vue'
import FieldRender from '@/components/table/fieldRender/index.vue' import FieldRender from '@/components/table/fieldRender/index.vue'
@@ -87,7 +86,7 @@ const tableRef = ref<VxeTableInstance>()
const tableStore = inject('tableStore') as TableStoreClass const tableStore = inject('tableStore') as TableStoreClass
const router = useRouter() const router = useRouter()
const key = ref(0) const key = ref(0)
interface Props extends /* @vue-ignore */ Partial<InstanceType<typeof ElTable>> { interface Props extends /* @vue-ignore */ Partial<VxeTableInstance> {
isGroup?: boolean isGroup?: boolean
showOverflow?: boolean | 'ellipsis' | 'title' | 'tooltip' showOverflow?: boolean | 'ellipsis' | 'title' | 'tooltip'
showCustomColumn?: boolean showCustomColumn?: boolean
@@ -109,7 +108,12 @@ const tableBindProps = computed(() => {
}) })
}) })
const openCustomColumn = () => { const openCustomColumn = () => {
tableRef.value?.openCustom?.() if (!tableRef.value) return
if (tableRef.value.getCustomVisible?.()) {
tableRef.value.closeCustom?.()
} else {
tableRef.value.openCustom?.()
}
} }
onMounted(() => { onMounted(() => {
if (!tableStore?.table) return if (!tableStore?.table) return
@@ -137,7 +141,7 @@ const handleSortChange = ({ field, order }: any) => {
// console.log('🚀 ~ handleSortChange ~ prop, order :', field, order) // console.log('🚀 ~ handleSortChange ~ prop, order :', field, order)
if (field && order) { if (field && order) {
// 根据当前排序条件对所有数据进行排序 // 根据当前排序条件对所有数据进行排序
const list = tableStore.table.copyData.sort((a, b) => { const list = tableStore.table.copyData.sort((a: any, b: any) => {
if (order === 'asc') { if (order === 'asc') {
return a[field] > b[field] ? 1 : -1 return a[field] > b[field] ? 1 : -1
} else { } else {

View File

@@ -189,7 +189,7 @@ const setData = (data: any) => {
fontSize: 16 fontSize: 16
} }
}, },
formatter: function (params) { formatter: function (params: any) {
// console.log("🚀 ~ data.forEach ~ params:", params) // console.log("🚀 ~ data.forEach ~ params:", params)
let tip = '' let tip = ''
for (let i = 0; i < params.length; i++) { for (let i = 0; i < params.length; i++) {
@@ -378,10 +378,10 @@ const changeDataType = () => {
let flag = dataType.value.includes(0) || dataType.value.includes(1) let flag = dataType.value.includes(0) || dataType.value.includes(1)
if (flag) { if (flag) {
let data1 = dataType.value.includes(0) let data1 = dataType.value.includes(0)
? loadList.map(k => (k.data == 3.14159 ? null : k.data)) ? loadList.map((k: any) => (k.data == 3.14159 ? null : k.data))
: [] : []
let data2 = dataType.value.includes(1) let data2 = dataType.value.includes(1)
? modOutList.map(k => (k.data == 3.14159 ? null : k.data)) ? modOutList.map((k: any) => (k.data == 3.14159 ? null : k.data))
: [] : []
let [modOuMin, modOuMax] = yMethod([...data1, ...data2]) let [modOuMin, modOuMax] = yMethod([...data1, ...data2])
@@ -476,7 +476,7 @@ const changeDataType = () => {
} }
if (dataType.value.includes(2)) { if (dataType.value.includes(2)) {
let [temperatureMin, temperatureMax] = yMethod( let [temperatureMin, temperatureMax] = yMethod(
temperatureList.map(k => (k.data == 3.14159 ? 0 : k.data)) temperatureList.map((k: any) => (k.data == 3.14159 ? 0 : k.data))
) )
echartsData.value.yAxis[flag ? 1 : 0] = { echartsData.value.yAxis[flag ? 1 : 0] = {
name: '℃', name: '℃',
@@ -508,7 +508,7 @@ const changeDataType = () => {
} }
key.value += 1 key.value += 1
} }
function renderItem(params, api) { function renderItem(params: any, api: any) {
var categoryIndex = api.value(0) var categoryIndex = api.value(0)
var start = api.coord([api.value(1), categoryIndex]) var start = api.coord([api.value(1), categoryIndex])
var end = api.coord([api.value(2), categoryIndex]) var end = api.coord([api.value(2), categoryIndex])
@@ -538,7 +538,7 @@ function renderItem(params, api) {
) )
} }
// 三角形标记渲染函数 // 三角形标记渲染函数
function renderMarker(params, api) { function renderMarker(params: any, api: any) {
var point = api.coord([api.value(0), 0]) var point = api.coord([api.value(0), 0])
var symbolSize = 8 var symbolSize = 8
var offsetY = 40 var offsetY = 40

View File

@@ -160,7 +160,7 @@ const handleaddDevice = () => {
query: { query: {
activeName: '0', activeName: '0',
id: lineId.value, id: lineId.value,
ndid: deviceData.value?.ndid, ndid: (deviceData.value as any)?.ndid || '',
} }
}) })

View File

@@ -29,7 +29,7 @@ import { saveLogParam } from '@/api/common'
defineOptions({ defineOptions({
name: 'comptroller/list' name: 'comptroller/list'
}) })
const tableStore = new TableStore({ const tableStore: any = new TableStore({
url: '/system-boot/audit/getAuditLog', url: '/system-boot/audit/getAuditLog',
method: 'POST', method: 'POST',
column: [ column: [

View File

@@ -47,7 +47,7 @@ defineOptions({
const dictData = useDictData() const dictData = useDictData()
const manufacturer = dictData.getBasicData('Dev_Manufacturers') const manufacturer = dictData.getBasicData('Dev_Manufacturers')
const manufacturerForm = ref<string[]>([]) const manufacturerForm = ref<string[]>([])
const tableStore = new TableStore({ const tableStore: any = new TableStore({
isWebPaging: true, isWebPaging: true,
url: '/device-boot/runManage/getRuntimeData', url: '/device-boot/runManage/getRuntimeData',
method: 'POST', method: 'POST',

View File

@@ -47,7 +47,7 @@ const interferenceSource = dictData.getBasicData('Interference_Source')
const level = dictData.getBasicData('Dev_Voltage_Stand') const level = dictData.getBasicData('Dev_Voltage_Stand')
const interferenceSourceForm = ref<string[]>([]) const interferenceSourceForm = ref<string[]>([])
const scaleForm = ref<string[]>([]) const scaleForm = ref<string[]>([])
const tableStore = new TableStore({ const tableStore: any = new TableStore({
isWebPaging: true, isWebPaging: true,
url: '/device-boot/runManage/getLineLedger', url: '/device-boot/runManage/getLineLedger',
method: 'POST', method: 'POST',

View File

@@ -32,7 +32,7 @@ defineOptions({
}) })
const popupEditRef = ref() const popupEditRef = ref()
const detail = ref<anyObj | null>(null) const detail = ref<anyObj | null>(null)
const tableStore = new TableStore({ const tableStore: any = new TableStore({
url: '/system-boot/dictType/list', url: '/system-boot/dictType/list',
method: 'POST', method: 'POST',
column: [ column: [

View File

@@ -102,7 +102,7 @@ const rules = {
iosPath: [{ required: true, message: '请输入IOS路径', trigger: 'blur' }] iosPath: [{ required: true, message: '请输入IOS路径', trigger: 'blur' }]
} }
const formRef = ref() const formRef = ref()
const tableStore = new TableStore({ const tableStore: any = new TableStore({
url: '/cs-system-boot/appVersion/getAllData', url: '/cs-system-boot/appVersion/getAllData',
method: 'POST', method: 'POST',
showPage: false, showPage: false,

View File

@@ -105,12 +105,12 @@ const tableStore: any = new TableStore({
onChangeField: (row: any, value: any) => { onChangeField: (row: any, value: any) => {
if (row.jobStatus == 1) { if (row.jobStatus == 1) {
stop({ id: row.id }).then(res => { stop({ id: row.id }).then(res => {
ElMessage.success(res.message) ElMessage.success((res as any).message)
tableStore.index() tableStore.index()
}) })
} else { } else {
start({ id: row.id }).then(res => { start({ id: row.id }).then(res => {
ElMessage.success(res.message) ElMessage.success((res as any).message)
tableStore.index() tableStore.index()
}) })
} }

View File

@@ -2,7 +2,7 @@
"compilerOptions": { "compilerOptions": {
"target": "esnext", "target": "esnext",
"useDefineForClassFields": true, "useDefineForClassFields": true,
"suppressImplicitAnyIndexErrors": true, // "suppressImplicitAnyIndexErrors": true,
"module": "esnext", "module": "esnext",
"moduleResolution": "node", "moduleResolution": "node",
"removeComments": false, "removeComments": false,