修改列设置点击问题
This commit is contained in:
@@ -1,414 +1,427 @@
|
|||||||
<template>
|
<template>
|
||||||
<div ref="tableHeader" class="cn-table-header">
|
<div ref="tableHeader" class="cn-table-header">
|
||||||
<div class="table-header ba-scroll-style" :key="num">
|
<div class="table-header ba-scroll-style" :key="num">
|
||||||
<el-form
|
<el-form
|
||||||
style="flex: 1; min-height: 34px; margin-right: 0px; display: flex; flex-wrap: wrap; align-items: center"
|
style="flex: 1; min-height: 34px; margin-right: 0px; display: flex; flex-wrap: wrap; align-items: center"
|
||||||
ref="headerForm"
|
ref="headerForm"
|
||||||
@submit.prevent=""
|
@submit.prevent=""
|
||||||
@keyup.enter="onComSearch"
|
@keyup.enter="onComSearch"
|
||||||
label-position="left"
|
label-position="left"
|
||||||
:inline="true"
|
:inline="true"
|
||||||
>
|
>
|
||||||
<el-form-item label="日期" v-if="datePicker" style="grid-column: span 2; max-width: 570px">
|
<el-form-item label="日期" v-if="datePicker" style="grid-column: span 2; max-width: 570px">
|
||||||
<DatePicker
|
<DatePicker
|
||||||
ref="datePickerRef"
|
ref="datePickerRef"
|
||||||
:nextFlag="nextFlag"
|
:nextFlag="nextFlag"
|
||||||
:theCurrentTime="theCurrentTime"
|
:theCurrentTime="theCurrentTime"
|
||||||
@change="handleDatePickerChange"
|
@change="handleDatePickerChange"
|
||||||
:timeKeyList="props.timeKeyList"
|
:timeKeyList="props.timeKeyList"
|
||||||
></DatePicker>
|
></DatePicker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="区域" v-if="area">
|
<el-form-item label="区域" v-if="area">
|
||||||
<Area ref="areaRef" v-model.trim="tableStore.table.params.deptIndex" />
|
<Area ref="areaRef" v-model.trim="tableStore.table.params.deptIndex" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<slot name="select"></slot>
|
<slot name="select"></slot>
|
||||||
</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"
|
||||||
v-if="showSearch &&showQuery"
|
v-if="showSearch &&showQuery"
|
||||||
:loading="tableStore.table.loading"
|
:loading="tableStore.table.loading"
|
||||||
type="primary"
|
type="primary"
|
||||||
:icon="Search"
|
:icon="Search"
|
||||||
>
|
>
|
||||||
查询
|
查询
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
@click="onResetForm"
|
@click="onResetForm"
|
||||||
v-if="showSearch && showReset"
|
v-if="showSearch && showReset"
|
||||||
:loading="tableStore.table.loading"
|
:loading="tableStore.table.loading"
|
||||||
:icon="RefreshLeft"
|
:icon="RefreshLeft"
|
||||||
>
|
>
|
||||||
重置
|
重置
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
@click="onExport"
|
@click="onExport"
|
||||||
v-if="showExport"
|
v-if="showExport"
|
||||||
:loading="tableStore.table.exportLoading"
|
:loading="tableStore.table.exportLoading"
|
||||||
type="primary"
|
type="primary"
|
||||||
icon="el-icon-Download"
|
icon="el-icon-Download"
|
||||||
>
|
>
|
||||||
导出
|
导出
|
||||||
</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
|
||||||
</div>
|
class="ml10 vxe-toolbar-custom-target"
|
||||||
<el-form
|
v-if="showCustomColumn"
|
||||||
:style="showSelect && showUnfoldButton ? headerFormSecondStyleOpen : headerFormSecondStyleClose"
|
:icon="Setting"
|
||||||
ref="headerFormSecond"
|
@click="openCustomColumn"
|
||||||
@submit.prevent=""
|
>
|
||||||
@keyup.enter="onComSearch"
|
列设置
|
||||||
label-position="left"
|
</el-button>
|
||||||
:inline="true"
|
</div>
|
||||||
></el-form>
|
<el-form
|
||||||
</div>
|
:style="showSelect && showUnfoldButton ? headerFormSecondStyleOpen : headerFormSecondStyleClose"
|
||||||
</template>
|
ref="headerFormSecond"
|
||||||
|
@submit.prevent=""
|
||||||
<script setup lang="ts">
|
@keyup.enter="onComSearch"
|
||||||
import { inject, ref, onMounted, nextTick, onUnmounted } from 'vue'
|
label-position="left"
|
||||||
import type TableStore from '@/utils/tableStore'
|
:inline="true"
|
||||||
import DatePicker from '@/components/form/datePicker/index.vue'
|
></el-form>
|
||||||
import Area from '@/components/form/area/index.vue'
|
</div>
|
||||||
import { mainHeight } from '@/utils/layout'
|
</template>
|
||||||
import { useDictData } from '@/stores/dictData'
|
|
||||||
import { Search, RefreshLeft, Setting } from '@element-plus/icons-vue'
|
<script setup lang="ts">
|
||||||
import { useTimeCacheStore } from '@/stores/timeCache'
|
import { inject, ref, onMounted, nextTick, onUnmounted } from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import type TableStore from '@/utils/tableStore'
|
||||||
|
import DatePicker from '@/components/form/datePicker/index.vue'
|
||||||
const emit = defineEmits(['selectChange','onResetForm'])
|
import Area from '@/components/form/area/index.vue'
|
||||||
|
import { mainHeight } from '@/utils/layout'
|
||||||
const tableStore = inject('tableStore') as TableStore
|
import { useDictData } from '@/stores/dictData'
|
||||||
const tableHeader = ref()
|
import { Search, RefreshLeft, Setting } from '@element-plus/icons-vue'
|
||||||
const datePickerRef = ref()
|
import { useTimeCacheStore } from '@/stores/timeCache'
|
||||||
const dictData = useDictData()
|
import { useRoute } from 'vue-router'
|
||||||
const areaRef = ref()
|
|
||||||
const headerForm = ref()
|
const emit = defineEmits(['selectChange','onResetForm'])
|
||||||
const headerFormSecond = ref()
|
|
||||||
const num = ref(0)
|
const tableStore = inject('tableStore') as TableStore
|
||||||
|
const tableHeader = ref()
|
||||||
// 获取路由和缓存 store
|
const datePickerRef = ref()
|
||||||
const route = useRoute()
|
const dictData = useDictData()
|
||||||
const timeCacheStore = useTimeCacheStore()
|
const areaRef = ref()
|
||||||
|
const headerForm = ref()
|
||||||
interface Props {
|
const headerFormSecond = ref()
|
||||||
datePicker?: boolean
|
const num = ref(0)
|
||||||
area?: boolean
|
|
||||||
showSearch?: boolean
|
// 获取路由和缓存 store
|
||||||
nextFlag?: boolean //控制时间是否可以往后推
|
const route = useRoute()
|
||||||
theCurrentTime?: boolean //控制时间前3天展示上个月时间
|
const timeCacheStore = useTimeCacheStore()
|
||||||
showQuery?: boolean //是否显示查詢
|
|
||||||
showReset?: boolean //是否显示重置
|
interface Props {
|
||||||
showExport?: boolean //导出控制
|
datePicker?: boolean
|
||||||
showCustomColumn?: boolean // 列设置
|
area?: boolean
|
||||||
timeCacheFlag?: boolean //是否取缓存时间
|
showSearch?: boolean
|
||||||
timeKeyList?: string[] //日期下拉列表
|
nextFlag?: boolean //控制时间是否可以往后推
|
||||||
}
|
theCurrentTime?: boolean //控制时间前3天展示上个月时间
|
||||||
|
showQuery?: boolean //是否显示查詢
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
showReset?: boolean //是否显示重置
|
||||||
datePicker: false,
|
showExport?: boolean //导出控制
|
||||||
area: false,
|
showCustomColumn?: boolean // 列设置
|
||||||
showSearch: true,
|
timeCacheFlag?: boolean //是否取缓存时间
|
||||||
nextFlag: false,
|
timeKeyList?: string[] //日期下拉列表
|
||||||
theCurrentTime: true,
|
}
|
||||||
showReset: true,
|
|
||||||
showQuery: true,
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
showExport: false,
|
datePicker: false,
|
||||||
showCustomColumn: false,
|
area: false,
|
||||||
timeCacheFlag: true,
|
showSearch: true,
|
||||||
timeKeyList: () => ['1', '2', '3', '4', '5'] // 修改为箭头函数返回空数组
|
nextFlag: false,
|
||||||
})
|
theCurrentTime: true,
|
||||||
|
showReset: true,
|
||||||
const openCustomColumn = () => {
|
showQuery: true,
|
||||||
tableStore?.table?.ref?.openCustom?.()
|
showExport: false,
|
||||||
}
|
showCustomColumn: false,
|
||||||
|
timeCacheFlag: true,
|
||||||
// 处理 DatePicker 值变化事件
|
timeKeyList: () => ['1', '2', '3', '4', '5'] // 修改为箭头函数返回空数组
|
||||||
const handleDatePickerChange = (value: any) => {
|
})
|
||||||
// 将值缓存到 timeCache
|
|
||||||
// if (value) {
|
const openCustomColumn = () => {
|
||||||
// timeCacheStore.setCache(route.path, value.interval, value.timeValue)
|
const tableRef = tableStore?.table?.ref
|
||||||
// }
|
if (!tableRef) return
|
||||||
|
if (tableRef.getCustomVisible?.()) {
|
||||||
// 将 datePicker 的变化传递给父组件
|
tableRef.closeCustom?.()
|
||||||
emit('selectChange', true, tableHeader.value.offsetHeight, value)
|
} else {
|
||||||
}
|
tableRef.openCustom?.()
|
||||||
|
}
|
||||||
// 动态计算table高度
|
}
|
||||||
let resizeObserver = new ResizeObserver(entries => {
|
|
||||||
for (const entry of entries) {
|
// 处理 DatePicker 值变化事件
|
||||||
handlerHeight()
|
const handleDatePickerChange = (value: any) => {
|
||||||
computedSearchRow()
|
// 将值缓存到 timeCache
|
||||||
}
|
// if (value) {
|
||||||
})
|
// timeCacheStore.setCache(route.path, value.interval, value.timeValue)
|
||||||
const showUnfoldButton = ref(false)
|
// }
|
||||||
const headerFormSecondStyleOpen = {
|
|
||||||
opacity: 1,
|
// 将 datePicker 的变化传递给父组件
|
||||||
height: 'auto',
|
emit('selectChange', true, tableHeader.value.offsetHeight, value)
|
||||||
padding: '0 15px 0px 15px'
|
}
|
||||||
}
|
|
||||||
const headerFormSecondStyleClose = {
|
// 动态计算table高度
|
||||||
opacity: 0,
|
let resizeObserver = new ResizeObserver(entries => {
|
||||||
height: '0',
|
for (const entry of entries) {
|
||||||
padding: '0'
|
handlerHeight()
|
||||||
}
|
computedSearchRow()
|
||||||
onMounted(() => {
|
}
|
||||||
if (props.showCustomColumn && tableStore?.table) {
|
})
|
||||||
tableStore.table.customColumnInHeader = true
|
const showUnfoldButton = ref(false)
|
||||||
}
|
const headerFormSecondStyleOpen = {
|
||||||
// 设置初始值到 DatePicker
|
opacity: 1,
|
||||||
if (props.datePicker && datePickerRef.value) {
|
height: 'auto',
|
||||||
// 从缓存中获取值并设置
|
padding: '0 15px 0px 15px'
|
||||||
const cached = timeCacheStore.getCache(route.path)
|
}
|
||||||
if (props.timeCacheFlag && cached) {
|
const headerFormSecondStyleClose = {
|
||||||
if (cached.interval !== undefined) {
|
opacity: 0,
|
||||||
datePickerRef.value.setInterval(cached.interval)
|
height: '0',
|
||||||
}
|
padding: '0'
|
||||||
if (cached.timeValue) {
|
}
|
||||||
datePickerRef.value.timeValue = cached.timeValue
|
onMounted(() => {
|
||||||
}
|
if (props.showCustomColumn && tableStore?.table) {
|
||||||
}
|
tableStore.table.customColumnInHeader = true
|
||||||
|
}
|
||||||
// 更新 tableStore 参数
|
// 设置初始值到 DatePicker
|
||||||
tableStore.table.params.searchBeginTime = datePickerRef.value?.timeValue?.[0]
|
if (props.datePicker && datePickerRef.value) {
|
||||||
tableStore.table.params.searchEndTime = datePickerRef.value?.timeValue?.[1]
|
// 从缓存中获取值并设置
|
||||||
tableStore.table.params.startTime = datePickerRef.value?.timeValue?.[0]
|
const cached = timeCacheStore.getCache(route.path)
|
||||||
tableStore.table.params.endTime = datePickerRef.value?.timeValue?.[1]
|
if (props.timeCacheFlag && cached) {
|
||||||
tableStore.table.params.timeFlag = datePickerRef.value?.timeFlag
|
if (cached.interval !== undefined) {
|
||||||
}
|
datePickerRef.value.setInterval(cached.interval)
|
||||||
|
}
|
||||||
if (props.area) {
|
if (cached.timeValue) {
|
||||||
tableStore.table.params.deptIndex = dictData.state.area[0].id
|
datePickerRef.value.timeValue = cached.timeValue
|
||||||
}
|
}
|
||||||
|
}
|
||||||
nextTick(() => {
|
|
||||||
resizeObserver.observe(tableHeader.value)
|
// 更新 tableStore 参数
|
||||||
computedSearchRow()
|
tableStore.table.params.searchBeginTime = datePickerRef.value?.timeValue?.[0]
|
||||||
})
|
tableStore.table.params.searchEndTime = datePickerRef.value?.timeValue?.[1]
|
||||||
})
|
tableStore.table.params.startTime = datePickerRef.value?.timeValue?.[0]
|
||||||
onUnmounted(() => {
|
tableStore.table.params.endTime = datePickerRef.value?.timeValue?.[1]
|
||||||
if (tableStore?.table) {
|
tableStore.table.params.timeFlag = datePickerRef.value?.timeFlag
|
||||||
tableStore.table.customColumnInHeader = false
|
}
|
||||||
}
|
|
||||||
resizeObserver.disconnect()
|
if (props.area) {
|
||||||
})
|
tableStore.table.params.deptIndex = dictData.state.area[0].id
|
||||||
|
}
|
||||||
const handlerHeight = () => {
|
|
||||||
if (tableStore && tableStore.table) {
|
nextTick(() => {
|
||||||
tableStore.table.height = mainHeight(
|
resizeObserver.observe(tableHeader.value)
|
||||||
tableStore.table.publicHeight + tableHeader.value.offsetHeight + (tableStore.showPage ? 58 : 0) + 20
|
computedSearchRow()
|
||||||
).height as string
|
})
|
||||||
}
|
})
|
||||||
}
|
onUnmounted(() => {
|
||||||
// 刷新页面handler高度出下拉
|
if (tableStore?.table) {
|
||||||
const computedSearchRow = () => {
|
tableStore.table.customColumnInHeader = false
|
||||||
if (!headerForm.value.$el) return
|
}
|
||||||
|
resizeObserver.disconnect()
|
||||||
// 清空headerFormSecond.value.$el下的元素
|
})
|
||||||
while (headerFormSecond.value.$el.firstChild) {
|
|
||||||
headerForm.value.$el.appendChild(headerFormSecond.value.$el.firstChild)
|
const handlerHeight = () => {
|
||||||
}
|
if (tableStore && tableStore.table) {
|
||||||
|
tableStore.table.height = mainHeight(
|
||||||
// 获取第一行放了几个表单
|
tableStore.table.publicHeight + tableHeader.value.offsetHeight + (tableStore.showPage ? 58 : 0) + 20
|
||||||
const elFormItem = headerForm.value.$el.querySelectorAll('.el-form-item')
|
).height as string
|
||||||
|
}
|
||||||
// 把第一行放不下的复制一份放到headerFormSecond.value.$el
|
}
|
||||||
let width = 0
|
// 刷新页面handler高度出下拉
|
||||||
for (let i = 0; i < elFormItem.length; i++) {
|
const computedSearchRow = () => {
|
||||||
width += elFormItem[i].offsetWidth + 32
|
if (!headerForm.value.$el) return
|
||||||
if (width > headerForm.value.$el.offsetWidth) {
|
|
||||||
headerFormSecond.value.$el.appendChild(elFormItem[i])
|
// 清空headerFormSecond.value.$el下的元素
|
||||||
}
|
while (headerFormSecond.value.$el.firstChild) {
|
||||||
}
|
headerForm.value.$el.appendChild(headerFormSecond.value.$el.firstChild)
|
||||||
|
}
|
||||||
// 判断是否需要折叠
|
|
||||||
if (headerFormSecond.value.$el.scrollHeight > 0) {
|
// 获取第一行放了几个表单
|
||||||
showUnfoldButton.value = true
|
const elFormItem = headerForm.value.$el.querySelectorAll('.el-form-item')
|
||||||
} else {
|
|
||||||
showUnfoldButton.value = false
|
// 把第一行放不下的复制一份放到headerFormSecond.value.$el
|
||||||
}
|
let width = 0
|
||||||
}
|
for (let i = 0; i < elFormItem.length; i++) {
|
||||||
|
width += elFormItem[i].offsetWidth + 32
|
||||||
const showSelect = ref(false)
|
if (width > headerForm.value.$el.offsetWidth) {
|
||||||
const showSelectChange = () => {
|
headerFormSecond.value.$el.appendChild(elFormItem[i])
|
||||||
showSelect.value = !showSelect.value
|
}
|
||||||
setTimeout(() => {
|
}
|
||||||
emit('selectChange', showSelect.value, tableHeader.value.offsetHeight)
|
|
||||||
}, 20)
|
// 判断是否需要折叠
|
||||||
}
|
if (headerFormSecond.value.$el.scrollHeight > 0) {
|
||||||
const onComSearch = async () => {
|
showUnfoldButton.value = true
|
||||||
if (props.datePicker) {
|
} else {
|
||||||
tableStore.table.params.searchBeginTime = datePickerRef.value.timeValue[0]
|
showUnfoldButton.value = false
|
||||||
tableStore.table.params.searchEndTime = datePickerRef.value.timeValue[1]
|
}
|
||||||
tableStore.table.params.startTime = datePickerRef.value.timeValue[0]
|
}
|
||||||
tableStore.table.params.endTime = datePickerRef.value.timeValue[1]
|
|
||||||
tableStore.table.params.timeFlag = datePickerRef.value.timeFlag
|
const showSelect = ref(false)
|
||||||
}
|
const showSelectChange = () => {
|
||||||
|
showSelect.value = !showSelect.value
|
||||||
await tableStore.onTableAction('search', {})
|
setTimeout(() => {
|
||||||
}
|
emit('selectChange', showSelect.value, tableHeader.value.offsetHeight)
|
||||||
const setDatePicker = (list: any) => {
|
}, 20)
|
||||||
datePickerRef.value.setTimeOptions(list)
|
}
|
||||||
}
|
const onComSearch = async () => {
|
||||||
const onResetForm = () => {
|
if (props.datePicker) {
|
||||||
//时间重置成默认值
|
tableStore.table.params.searchBeginTime = datePickerRef.value.timeValue[0]
|
||||||
datePickerRef.value?.setInterval(3)
|
tableStore.table.params.searchEndTime = datePickerRef.value.timeValue[1]
|
||||||
emit('onResetForm')
|
tableStore.table.params.startTime = datePickerRef.value.timeValue[0]
|
||||||
tableStore.onTableAction('reset', {})
|
tableStore.table.params.endTime = datePickerRef.value.timeValue[1]
|
||||||
}
|
tableStore.table.params.timeFlag = datePickerRef.value.timeFlag
|
||||||
const setInterval = (val: any) => {
|
}
|
||||||
datePickerRef.value.setInterval(val)
|
|
||||||
}
|
await tableStore.onTableAction('search', {})
|
||||||
|
}
|
||||||
const setTimeInterval = (val: any) => {
|
const setDatePicker = (list: any) => {
|
||||||
datePickerRef.value.timeValue = val
|
datePickerRef.value.setTimeOptions(list)
|
||||||
tableStore.table.params.searchBeginTime = val[0]
|
}
|
||||||
tableStore.table.params.searchEndTime = val[1]
|
const onResetForm = () => {
|
||||||
tableStore.table.params.startTime = val[0]
|
//时间重置成默认值
|
||||||
tableStore.table.params.endTime = val[1]
|
datePickerRef.value?.setInterval(3)
|
||||||
}
|
emit('onResetForm')
|
||||||
// 导出
|
tableStore.onTableAction('reset', {})
|
||||||
const onExport = () => {
|
}
|
||||||
tableStore.onTableAction('export', { showAllFlag: true })
|
const setInterval = (val: any) => {
|
||||||
}
|
datePickerRef.value.setInterval(val)
|
||||||
|
}
|
||||||
defineExpose({
|
|
||||||
onComSearch,
|
const setTimeInterval = (val: any) => {
|
||||||
areaRef,
|
datePickerRef.value.timeValue = val
|
||||||
setDatePicker,
|
tableStore.table.params.searchBeginTime = val[0]
|
||||||
setInterval,
|
tableStore.table.params.searchEndTime = val[1]
|
||||||
setTimeInterval,
|
tableStore.table.params.startTime = val[0]
|
||||||
datePickerRef,
|
tableStore.table.params.endTime = val[1]
|
||||||
showSelectChange,
|
}
|
||||||
computedSearchRow
|
// 导出
|
||||||
})
|
const onExport = () => {
|
||||||
</script>
|
tableStore.onTableAction('export', { showAllFlag: true })
|
||||||
|
}
|
||||||
<style scoped lang="scss">
|
|
||||||
.cn-table-header {
|
defineExpose({
|
||||||
border: 1px solid var(--el-border-color);
|
onComSearch,
|
||||||
}
|
areaRef,
|
||||||
|
setDatePicker,
|
||||||
.table-header {
|
setInterval,
|
||||||
position: relative;
|
setTimeInterval,
|
||||||
overflow-x: auto;
|
datePickerRef,
|
||||||
box-sizing: border-box;
|
showSelectChange,
|
||||||
display: flex;
|
computedSearchRow
|
||||||
align-items: center;
|
})
|
||||||
width: 100%;
|
</script>
|
||||||
max-width: 100%;
|
|
||||||
background-color: var(--ba-bg-color-overlay);
|
<style scoped lang="scss">
|
||||||
|
.cn-table-header {
|
||||||
border-bottom: none;
|
border: 1px solid var(--el-border-color);
|
||||||
padding: 13px 15px 9px;
|
}
|
||||||
font-size: 14px;
|
|
||||||
|
.table-header {
|
||||||
.table-header-operate-text {
|
position: relative;
|
||||||
margin-left: 6px;
|
overflow-x: auto;
|
||||||
}
|
box-sizing: border-box;
|
||||||
}
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
.table-com-search {
|
width: 100%;
|
||||||
box-sizing: border-box;
|
max-width: 100%;
|
||||||
width: 100%;
|
background-color: var(--ba-bg-color-overlay);
|
||||||
max-width: 100%;
|
|
||||||
background-color: var(--ba-bg-color-overlay);
|
border-bottom: none;
|
||||||
border: 1px solid var(--ba-border-color);
|
padding: 13px 15px 9px;
|
||||||
border-bottom: none;
|
font-size: 14px;
|
||||||
padding: 13px 15px 20px 15px;
|
|
||||||
font-size: 14px;
|
.table-header-operate-text {
|
||||||
}
|
margin-left: 6px;
|
||||||
|
}
|
||||||
#header-form-second,
|
}
|
||||||
#header-form {
|
|
||||||
// display: flex;
|
.table-com-search {
|
||||||
// flex-wrap: wrap;
|
box-sizing: border-box;
|
||||||
transition: all 0.3s;
|
width: 100%;
|
||||||
}
|
max-width: 100%;
|
||||||
|
background-color: var(--ba-bg-color-overlay);
|
||||||
.mlr-12 {
|
border: 1px solid var(--ba-border-color);
|
||||||
margin-left: 12px;
|
border-bottom: none;
|
||||||
}
|
padding: 13px 15px 20px 15px;
|
||||||
|
font-size: 14px;
|
||||||
.mlr-12 + .el-button {
|
}
|
||||||
margin-left: 12px;
|
|
||||||
}
|
#header-form-second,
|
||||||
|
#header-form {
|
||||||
.table-search {
|
// display: flex;
|
||||||
display: flex;
|
// flex-wrap: wrap;
|
||||||
margin-left: auto;
|
transition: all 0.3s;
|
||||||
|
}
|
||||||
.quick-search {
|
|
||||||
width: auto;
|
.mlr-12 {
|
||||||
}
|
margin-left: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.table-search-button-group {
|
.mlr-12 + .el-button {
|
||||||
display: flex;
|
margin-left: 12px;
|
||||||
margin-left: 12px;
|
}
|
||||||
border: 1px solid var(--el-border-color);
|
|
||||||
border-radius: var(--el-border-radius-base);
|
.table-search {
|
||||||
overflow: hidden;
|
display: flex;
|
||||||
|
margin-left: auto;
|
||||||
button:focus,
|
|
||||||
button:active {
|
.quick-search {
|
||||||
background-color: var(--ba-bg-color-overlay);
|
width: auto;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
button:hover {
|
|
||||||
background-color: var(--el-color-info-light-7);
|
.table-search-button-group {
|
||||||
}
|
display: flex;
|
||||||
|
margin-left: 12px;
|
||||||
.table-search-button-item {
|
border: 1px solid var(--el-border-color);
|
||||||
height: 30px;
|
border-radius: var(--el-border-radius-base);
|
||||||
border: none;
|
overflow: hidden;
|
||||||
border-radius: 0;
|
|
||||||
}
|
button:focus,
|
||||||
|
button:active {
|
||||||
.el-button + .el-button {
|
background-color: var(--ba-bg-color-overlay);
|
||||||
margin: 0;
|
}
|
||||||
}
|
|
||||||
|
button:hover {
|
||||||
.right-border {
|
background-color: var(--el-color-info-light-7);
|
||||||
border-right: 1px solid var(--el-border-color);
|
}
|
||||||
}
|
|
||||||
}
|
.table-search-button-item {
|
||||||
|
height: 30px;
|
||||||
html.dark {
|
border: none;
|
||||||
.table-search-button-group {
|
border-radius: 0;
|
||||||
button:focus,
|
}
|
||||||
button:active {
|
|
||||||
background-color: var(--el-color-info-dark-2);
|
.el-button + .el-button {
|
||||||
}
|
margin: 0;
|
||||||
|
}
|
||||||
button:hover {
|
|
||||||
background-color: var(--el-color-info-light-7);
|
.right-border {
|
||||||
}
|
border-right: 1px solid var(--el-border-color);
|
||||||
|
}
|
||||||
button {
|
}
|
||||||
background-color: var(--ba-bg-color-overlay);
|
|
||||||
|
html.dark {
|
||||||
el-icon {
|
.table-search-button-group {
|
||||||
color: white !important;
|
button:focus,
|
||||||
}
|
button:active {
|
||||||
}
|
background-color: var(--el-color-info-dark-2);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
button:hover {
|
||||||
#header-form,
|
background-color: var(--el-color-info-light-7);
|
||||||
#header-form-second {
|
}
|
||||||
:deep(.el-select) {
|
|
||||||
--el-select-width: 220px;
|
button {
|
||||||
}
|
background-color: var(--ba-bg-color-overlay);
|
||||||
|
|
||||||
:deep(.el-input) {
|
el-icon {
|
||||||
--el-input-width: 220px;
|
color: white !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</style>
|
}
|
||||||
|
|
||||||
|
#header-form,
|
||||||
|
#header-form-second {
|
||||||
|
:deep(.el-select) {
|
||||||
|
--el-select-width: 220px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-input) {
|
||||||
|
--el-input-width: 220px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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 || '',
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -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: [
|
||||||
|
|||||||
@@ -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',
|
||||||
|
|||||||
@@ -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',
|
||||||
|
|||||||
@@ -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: [
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user