驾驶舱页面绘制

绘制2、稳态电能质量分析、稳态治理效果分析、暂态电能质量分析页面
This commit is contained in:
guanj
2025-10-20 13:25:30 +08:00
parent 177e50de75
commit 676bb37bbe
52 changed files with 12265 additions and 3807 deletions

View File

@@ -0,0 +1,72 @@
import createAxios from '@/utils/request'
const SYSTEM_PREFIX = '/system-boot'
/**
* 上传文件
* @param file
*/
export const uploadFile = (file: any, path: string) => {
let form = new FormData()
form.append('file', file)
form.append('path', path)
return createAxios({
url: SYSTEM_PREFIX + '/file/upload',
method: 'POST',
headers: {
'Content-Type': 'multipart/form-data'
},
data: form
})
}
/**
* 删除文件
*/
export const deleteFile = (filePath: string) => {
let form = new FormData()
form.append('filePath', filePath)
return createAxios({
url: SYSTEM_PREFIX + '/file/delete',
method: 'POST',
data: form
})
}
/**
* 下载文件
*/
export const downloadFile = (filePath: any) => {
// let form = new FormData()
// form.append('filePath', filePath)
return createAxios({
url: SYSTEM_PREFIX + '/file/download',
method: 'GET',
params: filePath,
responseType: 'blob'
})
}
/**
* 获取文件的短期url展示
*/
export const getFileUrl = (params:any) => {
let form = new FormData()
// form.append('filePath', filePath)
return createAxios({
url: SYSTEM_PREFIX + '/file/getFileUrl',
method: 'get',
params
})
}
/**
* 根据获取文件的一个短期url及文件名
*/
export const getFileNameAndFilePath = (query: any) => {
return createAxios({
url: SYSTEM_PREFIX + '/file/getFileVO',
method: 'GET',
params: query
})
}

BIN
src/assets/img/amplify.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
src/assets/img/reduce.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@@ -0,0 +1,344 @@
<template>
<div>
<!--F47曲线 -->
<el-descriptions class="mt2" direction="vertical" :column="4" border>
<el-descriptions-item align="center" label="名称">{{ data.name }}</el-descriptions-item>
<el-descriptions-item align="center" label="事件总数">{{ data.gs }}</el-descriptions-item>
<el-descriptions-item align="center" label="可容忍">{{ data.krr }}</el-descriptions-item>
<el-descriptions-item align="center" label="不可容忍">{{ data.bkrr }}</el-descriptions-item>
</el-descriptions>
<my-echart
class="tall"
:options="echartList"
:style="{ width: prop.width, height: `calc(${prop.height} - 80px)` }"
/>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, provide, reactive, watch, h } from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import MyEchart from '@/components/echarts/MyEchart.vue'
import { useDictData } from '@/stores/dictData'
import { ElMessage, ElMessageBox } from 'element-plus'
import { getTimeOfTheMonth } from '@/utils/formatTime'
const prop = defineProps({
width: { type: String },
height: { type: String },
timeKey: { type: String },
timeValue: { type: Object }
})
const echartList = ref({})
const OverLimitDetailsRef = ref()
const data = reactive({
name: '事件个数',
gs: 0,
krr: 0,
bkrr: 0
})
const tableStore: any = new TableStore({
url: '/user-boot/dept/deptTree',
method: 'POST',
showPage: false,
column: [],
beforeSearchFun: () => {
tableStore.table.params.searchBeginTime = prop.timeValue?.[0] || getTimeOfTheMonth(prop.timeKey)[0]
tableStore.table.params.searchEndTime = prop.timeValue?.[1] || getTimeOfTheMonth(prop.timeKey)[1]
},
loadCallback: () => {
let res = {
data: { totalNumberOfEvents: 0, voltageToleranceCurveDataList: [] }
}
const gongData = gongfunction(res.data.voltageToleranceCurveDataList)
data.gs = res.data.voltageToleranceCurveDataList.length
data.krr = gongData.pointI.length
data.bkrr = gongData.pointIun.length
console.log(gongData)
echartList.value = {
// backgroundColor: "#f9f9f9", //地图背景色深蓝
title: {
text: `F47曲线`
},
legend: {
data: ['上限', '下限', '可容忍事件', '不可容忍事件']
},
tooltip: {
trigger: 'item',
show: true,
axisPointer: {
type: 'shadow',
label: {
color: '#fff',
fontSize: 16
}
},
textStyle: {
color: '#fff',
fontStyle: 'normal',
opacity: 0.35,
fontSize: 14
},
backgroundColor: 'rgba(0,0,0,0.55)',
borderWidth: 0,
formatter: function (a: any) {
var relVal = ''
relVal = "<font style='color:" + "'>发生时间:" + a.value[2] + '</font><br/>'
relVal += "<font style='color:" + "'>持续时间:" + a.value[0] + 's</font><br/>'
relVal += "<font style='color:" + "'>特征幅值:" + a.value[1].toFixed(2) + '%</font>'
return relVal
}
},
xAxis: [
{
type: 'log',
min: 0.001,
max: 1000,
splitLine: {
show: false
},
name: 's'
}
],
yAxis: [
{
type: 'value',
max: function (value: any) {
return value.max + 20
},
splitNumber: 10,
minInterval: 0.1,
name: '%'
}
],
color: ['#DAA520', 'green', 'red'],
options: {
dataZoom: null,
series: [
{
name: '边界线',
type: 'line',
data: [
[0.05, 0],
[0.05, 50],
[0.2, 50],
[0.2, 70],
[0.5, 70],
[0.5, 80],
[10, 80],
[1000, 80]
],
showSymbol: false,
tooltips: {
show: false
}
},
{
name: '可容忍事件',
type: 'scatter',
symbol: 'circle',
data: gongData.pointF
},
{
name: '不可容忍事件',
type: 'scatter',
symbol: 'circle',
data: gongData.pointFun
}
]
}
}
}
})
const tableRef = ref()
provide('tableRef', tableRef)
provide('tableStore', tableStore)
function gongfunction(arr: any) {
let standI = 0
let unstandI = 0
let standF = 0
let unstandF = 0
let total = 0
let pointIun = []
let pointI = []
let pointF = []
let pointFun = []
total = arr.length
if (total == 0) {
} else {
for (let i = 0; i < arr.length; i++) {
let point = []
let xx = arr[i].persistTime
let yy = arr[i].eventValue
let time = arr[i].time
let eventId = arr[i].eventId
// let index =arr[i].eventDetailIndex;
point = [xx, yy, time, eventId]
if (xx <= 0.003) {
let line = 0
line = 250 - 30000 * xx
if (yy > line) {
unstandI++
pointIun.push({
value: point,
itemStyle: { normal: { color: 'red' } }
})
} else {
standI++
pointI.push({
value: point,
itemStyle: { normal: { color: 'green' } }
})
}
} else if (xx <= 0.02) {
if (yy > 120) {
unstandI++
pointIun.push({
value: point,
itemStyle: { normal: { color: 'red' } }
})
} else {
standI++
pointI.push({
value: point,
itemStyle: { normal: { color: 'green' } }
})
}
} else if (xx <= 0.5) {
if (yy > 120 || yy < 70) {
unstandI++
pointIun.push({
value: point,
itemStyle: { normal: { color: 'red' } }
})
} else {
standI++
pointI.push({
value: point,
itemStyle: { normal: { color: 'green' } }
})
}
} else if (xx <= 10) {
if (yy > 110 || yy < 80) {
unstandI++
pointIun.push({
value: point,
itemStyle: { normal: { color: 'red' } }
})
} else {
standI++
pointI.push({
value: point,
itemStyle: { normal: { color: 'green' } }
})
}
} else {
if (yy > 110 || yy < 90) {
unstandI++
pointIun.push({
value: point,
itemStyle: { normal: { color: 'red' } }
})
} else {
standI++
pointI.push({
value: point,
itemStyle: { normal: { color: 'green' } }
})
}
}
if (xx < 0.05) {
standF++
pointF.push({
value: point,
itemStyle: { normal: { color: 'green' } }
})
} else if (xx < 0.2) {
if (yy > 50) {
standF++
pointF.push({
value: point,
itemStyle: { normal: { color: 'green' } }
})
} else {
unstandF++
pointFun.push({
value: point,
itemStyle: { normal: { color: 'red' } }
})
}
} else if (xx < 0.5) {
if (yy > 70) {
standF++
pointF.push({
value: point,
itemStyle: { normal: { color: 'green' } }
})
} else {
unstandF++
pointFun.push({
value: point,
itemStyle: { normal: { color: 'red' } }
})
}
} else {
if (yy > 80) {
standF++
pointF.push({
value: point,
itemStyle: { normal: { color: 'green' } }
})
} else {
unstandF++
pointFun.push({
value: point,
itemStyle: { normal: { color: 'red' } }
})
}
}
}
}
return {
standI,
unstandI,
pointI,
pointIun,
standF,
unstandF,
pointF,
pointFun
}
}
onMounted(() => {
setTimeout(() => {
tableStore.index()
}, 100)
})
watch(
() => prop.timeKey,
val => {
tableStore.index()
}
)
watch(
() => prop.timeValue, // 监听的目标(函数形式避免直接传递 props 导致的警告)
(newVal, oldVal) => {
tableStore.index()
},
{
deep: true // 若 timeValue 是对象/数组,需开启深度监听
}
)
const addMenu = () => {}
</script>
<style lang="scss" scoped></style>

View File

@@ -0,0 +1,136 @@
<template>
<div>
<!--暂降方向统计 -->
<my-echart class="tall" :options="echartList" :style="{ width: prop.width, height: `calc(${prop.height} )` }" />
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, provide, reactive, watch, h } from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import MyEchart from '@/components/echarts/MyEchart.vue'
import { useDictData } from '@/stores/dictData'
import { ElMessage, ElMessageBox } from 'element-plus'
import { getTimeOfTheMonth } from '@/utils/formatTime'
const prop = defineProps({
width: { type: String },
height: { type: String },
timeKey: { type: String },
timeValue: { type: Object }
})
const data = [
{
name: '来自电网',
value: 4
},
{
name: '来自负荷',
value: 41
}
]
const echartList = ref({
title: {},
tooltip: {
trigger: 'item'
},
legend: {
orient: 'vertical',
top: 'center',
right: '5%',
formatter: function (e: any) {
return e + ' ' + data.filter(item => item.name == e)[0].value + '次'
}
},
xAxis: {
show: false
},
yAxis: {
show: false
},
grid: {
left: '10px',
right: '20px'
},
options: {
dataZoom: null,
title: [
{
text: '暂降方向统计',
left: 'center'
},
{
text: data[0].value + data[1].value + '次',
left: 'center',
top: 'center'
}
],
series: [
{
type: 'pie',
center: 'center',
radius: ['55%', '75%'],
label: {
show: false,
position: 'outside',
textStyle: {
//数值样式
}
},
name: '事件统计',
data: data
}
]
}
})
const OverLimitDetailsRef = ref()
const tableStore: any = new TableStore({
url: '/user-boot/dept/deptTree',
method: 'POST',
showPage: false,
column: [],
beforeSearchFun: () => {
tableStore.table.params.searchBeginTime = prop.timeValue?.[0] || getTimeOfTheMonth(prop.timeKey)[0]
tableStore.table.params.searchEndTime = prop.timeValue?.[1] || getTimeOfTheMonth(prop.timeKey)[1]
},
loadCallback: () => {}
})
const tableRef = ref()
provide('tableRef', tableRef)
provide('tableStore', tableStore)
// 点击行
const cellClickEvent = ({ row, column }: any) => {
if (column.field != 'name') {
console.log(row)
OverLimitDetailsRef.value.open(row)
}
}
onMounted(() => {
tableStore.index()
})
watch(
() => prop.timeKey,
val => {
tableStore.index()
}
)
watch(
() => prop.timeValue, // 监听的目标(函数形式避免直接传递 props 导致的警告)
(newVal, oldVal) => {
tableStore.index()
},
{
deep: true // 若 timeValue 是对象/数组,需开启深度监听
}
)
const addMenu = () => {}
</script>
<style lang="scss" scoped></style>

View File

@@ -0,0 +1,206 @@
<template>
<div>
<!--指标越限程度 -->
<my-echart
class="tall"
:options="echartList"
:style="{ width: prop.width, height: `calc(${prop.height} / 2 )` }"
/>
<Table ref="tableRef" @cell-click="cellClickEvent" :height="`calc(${prop.height} / 2 )`" isGroup></Table>
<!-- 指标越限详情 -->
<OverLimitDetails ref="OverLimitDetailsRef" />
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, provide, reactive, watch, h } from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import MyEchart from '@/components/echarts/MyEchart.vue'
import { useDictData } from '@/stores/dictData'
import { ElMessage, ElMessageBox } from 'element-plus'
import { getTimeOfTheMonth } from '@/utils/formatTime'
import OverLimitDetails from '@/components/cockpit/listOfMainMonitoringPoints/components/overLimitDetails.vue'
const prop = defineProps({
width: { type: String },
height: { type: String },
timeKey: { type: String },
timeValue: { type: Object }
})
const echartList = ref({
title: {
text: '指标越限严重度'
},
xAxis: {
// name: '(区域)',
data: ['闪变', '谐波电压', '谐波电流', '电压偏差', '三相不平衡']
},
yAxis: {
name: '%', // 给X轴加单位
interval: 20
},
grid: {
left: '10px',
right: '20px'
},
options: {
series: [
{
// name: '暂降次数',
type: 'bar',
name: '越限占比',
data: [0, 7.5, 36, 0, 80],
barMaxWidth: 30
// label: {
// show: true,
// position: 'top',
// textStyle: {
// //数值样式
// color: '#000'
// },
// fontSize: 12
// }
}
]
}
})
const OverLimitDetailsRef = ref()
const tableStore: any = new TableStore({
url: '/user-boot/dept/deptTree',
method: 'POST',
showPage: false,
column: [
{
field: 'index',
title: '序号',
width: '60',
formatter: (row: any) => {
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
}
},
{
title: '指标名称',
field: 'name',
minWidth: '90'
},
{
title: '越限最大值',
field: 'type',
minWidth: '60',
render: 'customTemplate',
customTemplate: (row: any) => {
return `<span style='cursor: pointer;text-decoration: underline;'>${row.type}</span>`
}
},
{
title: '国标限值',
field: 'type1',
minWidth: '60'
},
{
title: '越限程度(%)',
field: 'type2',
minWidth: '60'
},
{
title: '发生日期',
field: 'type3',
minWidth: '100'
},
{
title: '越限最高监测点',
field: 'type4',
minWidth: '90'
}
],
beforeSearchFun: () => {
tableStore.table.params.searchBeginTime = prop.timeValue?.[0] || getTimeOfTheMonth(prop.timeKey)[0]
tableStore.table.params.searchEndTime = prop.timeValue?.[1] || getTimeOfTheMonth(prop.timeKey)[1]
},
loadCallback: () => {
tableStore.table.data = [
{
name: '闪变',
type: '0.0',
type1: '2.0',
type2: '0.0',
type3: '/',
type4: '/'
},
{
name: '谐波电压',
type: '1.72',
type1: '1.6',
type2: '7.5',
type3: '2025-03-09',
type4: '10kV1#电动机'
},
{
name: '谐波电流',
type: '27.2',
type1: '20.0',
type2: '36.0',
type3: '2025-03-16',
type4: '380V电焊机(治理前)'
},
{
name: '电压偏差',
type: '0.0',
type1: '2.0',
type2: '0.0',
type3: '/',
type4: '/'
},
{
name: '三相不平衡',
type: '3.6',
type1: '2.0',
type2: '80.0',
type3: '2025-03-01',
type4: '380V电焊机(治理前)'
}
]
}
})
const tableRef = ref()
provide('tableRef', tableRef)
provide('tableStore', tableStore)
// 点击行
const cellClickEvent = ({ row, column }: any) => {
if (column.field != 'name') {
console.log(row)
OverLimitDetailsRef.value.open(row)
}
}
onMounted(() => {
tableStore.index()
})
watch(
() => prop.timeKey,
val => {
tableStore.index()
}
)
watch(
() => prop.timeValue, // 监听的目标(函数形式避免直接传递 props 导致的警告)
(newVal, oldVal) => {
tableStore.index()
},
{
deep: true // 若 timeValue 是对象/数组,需开启深度监听
}
)
const addMenu = () => {}
</script>
<style lang="scss" scoped></style>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,124 @@
<template>
<div>
<!--治理效果报表 -->
<TableHeader :showReset="false">
<template v-slot:select>
<el-form-item label="治理对象">
<el-select
v-model="tableStore.table.params.power"
placeholder="请选择治理对象"
clearable
style="width: 130px"
>
<el-option
v-for="item in powerList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</template>
<template v-slot:operation>
<el-button @click="downloadExcel" class="" type="primary" icon="el-icon-Download">导出excel</el-button>
</template>
</TableHeader>
<div style="display: flex">
<div
id="luckysheet"
:style="{ width: `calc(${prop.width} )`, height: `calc(${prop.height} - 57px )` }"
></div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, provide, reactive, watch, h } from 'vue'
import TableStore from '@/utils/tableStore'
import { exportExcel } from '@/views/govern/reportForms/export.js'
import TableHeader from '@/components/table/header/index.vue'
import { useDictData } from '@/stores/dictData'
import { ElMessage, ElMessageBox } from 'element-plus'
import { getTimeOfTheMonth } from '@/utils/formatTime'
import MyEchart from '@/components/echarts/MyEchart.vue'
import { useConfig } from '@/stores/config'
import Json from './index.json'
const prop = defineProps({
width: { type: String },
height: { type: String },
timeKey: { type: String },
timeValue: { type: Object }
})
const config = useConfig()
const powerList: any = ref([
{
label: '1#变压器',
value: '1'
},
{
label: '2#变压器',
value: '2'
}
])
const tableStore: any = new TableStore({
url: '/user-boot/role/selectRoleDetail?id=0',
method: 'POST',
showPage: false,
exportName: '主要监测点列表',
column: [],
beforeSearchFun: () => {
tableStore.table.params.searchBeginTime = prop.timeValue?.[0] || getTimeOfTheMonth(prop.timeKey)[0]
tableStore.table.params.searchEndTime = prop.timeValue?.[1] || getTimeOfTheMonth(prop.timeKey)[1]
},
loadCallback: () => {}
})
const tableRef = ref()
provide('tableRef', tableRef)
tableStore.table.params.power = '1'
provide('tableStore', tableStore)
// 下载表格
const downloadExcel = () => {
exportExcel(luckysheet.getAllSheets(), '治理效果报表')
}
onMounted(() => {
luckysheet.create({
container: 'luckysheet',
title: '', // 表 头名
lang: 'zh', // 中文
showtoolbar: false, // 是否显示工具栏
showinfobar: false, // 是否显示顶部信息栏
showsheetbar: true, // 是否显示底部sheet按钮
allowEdit: false, // 禁止所有编辑操作(必填)
data: Json
})
tableStore.index()
})
watch(
() => prop.timeKey,
val => {
tableStore.index()
}
)
watch(
() => prop.timeValue, // 监听的目标(函数形式避免直接传递 props 导致的警告)
(newVal, oldVal) => {
tableStore.index()
},
{
deep: true // 若 timeValue 是对象/数组,需开启深度监听
}
)
const addMenu = () => {}
</script>
<style lang="scss" scoped>
:deep(.el-select) {
min-width: 80px;
}
</style>

View File

@@ -0,0 +1,196 @@
<template>
<div>
<!--电网侧指标越限统计 -->
<my-echart
class="tall"
:options="echartList"
:style="{ width: prop.width, height: `calc(${prop.height} / 2 )` }"
/>
<Table ref="tableRef" @cell-click="cellClickEvent" :height="`calc(${prop.height} / 2 )`" isGroup></Table>
<!-- 指标越限详情 -->
<OverLimitDetails ref="OverLimitDetailsRef" />
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, provide, reactive, watch, h } from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import MyEchart from '@/components/echarts/MyEchart.vue'
import { useDictData } from '@/stores/dictData'
import { ElMessage, ElMessageBox } from 'element-plus'
import { getTimeOfTheMonth } from '@/utils/formatTime'
import OverLimitDetails from '@/components/cockpit/listOfMainMonitoringPoints/components/overLimitDetails.vue'
const prop = defineProps({
width: { type: String },
height: { type: String },
timeKey: { type: String },
timeValue: { type: Object }
})
const echartList = ref({
title: {
text: '指标越限占比'
},
xAxis: {
// name: '(区域)',
data: ['闪变', '谐波电压', '谐波电流', '电压偏差', '三相不平衡']
},
yAxis: {
name: '%', // 给X轴加单位
interval: 20
},
grid: {
left: '10px',
right: '20px'
},
options: {
series: [
{
// name: '暂降次数',
type: 'bar',
name: '越限占比',
data: [0, 45, 22, 0, 70],
barMaxWidth: 30,
// label: {
// show: true,
// position: 'top',
// textStyle: {
// //数值样式
// color: '#000'
// },
// fontSize: 12
// }
}
]
}
})
const OverLimitDetailsRef = ref()
const tableStore: any = new TableStore({
url: '/user-boot/dept/deptTree',
method: 'POST',
showPage: false,
column: [
{
field: 'index',
title: '序号',
width: '60',
formatter: (row: any) => {
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
}
},
{
title: '名称',
field: 'name',
minWidth: '90'
},
{
title: '越限占比(%)',
children: [
{
title: '闪变',
field: 'type',
minWidth: '70',
render: 'customTemplate',
customTemplate: (row: any) => {
return `<span style='cursor: pointer;text-decoration: underline;'>${row.type}</span>`
}
},
{
title: '谐波电压',
field: 'type1',
minWidth: '80',
render: 'customTemplate',
customTemplate: (row: any) => {
return `<span style='cursor: pointer;text-decoration: underline;'>${row.type1}</span>`
}
},
{
title: '谐波电流',
field: 'type2',
minWidth: '80',
render: 'customTemplate',
customTemplate: (row: any) => {
return `<span style='cursor: pointer;text-decoration: underline;'>${row.type2}</span>`
}
},
{
title: '电压偏差',
field: 'type3',
minWidth: '80',
render: 'customTemplate',
customTemplate: (row: any) => {
return `<span style='cursor: pointer;text-decoration: underline;'>${row.type3}</span>`
}
},
{
title: '三相不平衡',
field: 'type4',
minWidth: '90',
render: 'customTemplate',
customTemplate: (row: any) => {
return `<span style='cursor: pointer;text-decoration: underline;'>${row.type4}</span>`
}
}
]
}
],
beforeSearchFun: () => {
tableStore.table.params.searchBeginTime = prop.timeValue?.[0] || getTimeOfTheMonth(prop.timeKey)[0]
tableStore.table.params.searchEndTime = prop.timeValue?.[1] || getTimeOfTheMonth(prop.timeKey)[1]
},
loadCallback: () => {
tableStore.table.data = [
{
name: '1#变压器电网侧',
type: '0',
type1: '45',
type2: '22',
type3: '0',
type4: '70'
}
]
tableStore.table.height = `calc(${prop.height} - 80px)`
}
})
const tableRef = ref()
provide('tableRef', tableRef)
provide('tableStore', tableStore)
// 点击行
const cellClickEvent = ({ row, column }: any) => {
if (column.field != 'name') {
console.log(row)
OverLimitDetailsRef.value.open(row)
}
}
onMounted(() => {
tableStore.index()
})
watch(
() => prop.timeKey,
val => {
tableStore.index()
}
)
watch(
() => prop.timeValue, // 监听的目标(函数形式避免直接传递 props 导致的警告)
(newVal, oldVal) => {
tableStore.index()
},
{
deep: true // 若 timeValue 是对象/数组,需开启深度监听
}
)
const addMenu = () => {}
</script>
<style lang="scss" scoped></style>

View File

@@ -0,0 +1,186 @@
<template>
<div>
<!--指标越限明细 -->
<el-calendar v-model="value" :style="{ height: prop.height, overflow: 'auto' }">
<template #date-cell="{ data }">
<div style="height: 100%; padding: 8px" :style="{ background: setBackground(data.day) }">
<p :class="data.isSelected ? 'is-selected' : ''">
{{ data.day.split('-').slice(2).join('-') }}
</p>
<el-tooltip
effect="dark"
placement="top"
:hide-after="0"
v-if="list?.filter(item => item.time == data.day)[0]?.text || false"
>
<template #content>
<span v-html="list?.filter(item => item.time == data.day)[0]?.text || ''"></span>
</template>
<div
:style="{ height: `calc(${prop.height} / 5 - 47px)`, overflow: 'auto' }"
v-html="list?.filter(item => item.time == data.day)[0]?.text || ''"
></div>
</el-tooltip>
</div>
</template>
</el-calendar>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, provide, reactive, watch, h } from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import { useDictData } from '@/stores/dictData'
import { ElMessage, ElMessageBox } from 'element-plus'
import { getTimeOfTheMonth } from '@/utils/formatTime'
import { overflow } from 'html2canvas/dist/types/css/property-descriptors/overflow'
import { dayjs } from 'element-plus'
dayjs.en.weekStart = 1 //设置日历的周起始日为星期一
const value = ref(new Date())
const prop = defineProps({
width: { type: String },
height: { type: String },
timeKey: { type: String },
timeValue: { type: Object }
})
const list = ref([
{
time: '2025-10-01',
key: 81,
text: '3次谐波越限<br/>5次谐波越限<br/>三相不平衡越限'
},
{
time: '2025-10-31',
key: 81,
text: '3次谐波越限<br/>5次谐波越限<br/>三相不平衡越限'
},
{
time: '2025-10-08',
key: 20,
text: '3次谐波越限<br/>5次谐波越限<br/>三相不平衡越限'
},
{
time: '2025-10-16',
key: 20,
text: '3次谐波越限<br/>5次谐波越限<br/>三相不平衡越限'
},
{
time: '2025-10-23',
key: 20,
text: '3次谐波越限<br/>5次谐波越限<br/>三相不平衡越限'
},
{
time: '2025-10-04',
key: 0,
text: ''
},
{
time: '2025-10-05',
key: 0,
text: ''
}
])
const tableStore: any = new TableStore({
url: '/user-boot/dept/deptTree',
method: 'POST',
showPage: false,
column: [],
beforeSearchFun: () => {
tableStore.table.params.searchBeginTime = prop.timeValue?.[0] || getTimeOfTheMonth(prop.timeKey)[0]
tableStore.table.params.searchEndTime = prop.timeValue?.[1] || getTimeOfTheMonth(prop.timeKey)[1]
// value.value = new Date(prop.timeValue?.[0])
},
loadCallback: () => {
tableStore.table.data = []
}
})
const tableRef = ref([])
const setBackground = (value: string) => {
let data = []
data = list.value?.filter(item => item.time == value)
if (data && data?.length > 0) {
if (data[0].key < 10) {
return '#33996690'
} else if (data[0].key < 80) {
return '#FFCC3390'
} else if (data[0].key <= 100) {
return '#Ff660090'
}
}
return '#fff'
}
provide('tableRef', tableRef)
provide('tableStore', tableStore)
onMounted(() => {
tableStore.index()
})
watch(
() => prop.timeKey,
val => {
tableStore.index()
}
)
watch(
() => prop.timeValue, // 监听的目标(函数形式避免直接传递 props 导致的警告)
(newVal, oldVal) => {
tableStore.index()
},
{
deep: true // 若 timeValue 是对象/数组,需开启深度监听
}
)
const addMenu = () => {}
</script>
<style lang="scss" scoped>
:deep(.el-calendar) {
.el-calendar__header {
display: none;
}
.el-calendar__body {
padding: 0px !important;
height: 100%;
.el-calendar-table {
height: 100%;
}
}
.el-calendar-day {
height: 100%;
padding: 0px;
overflow: hidden;
}
.el-calendar-table__row {
.next {
pointer-events: none;
}
.prev {
pointer-events: none;
}
}
.el-calendar-table .el-calendar-day:hover {
background-color: #ffffff00;
}
.el-calendar-table td.is-selected {
background-color: #ffffff00;
}
}
// /*calendar_class 是el-calendar所在父标签的css*/
// .calendar_class >>> .el-calendar-table:not(.is-range) td.next {
// pointer-events: none;
// }
// .calendar_class >>> .el-calendar-table:not(.is-range) td.prev {
// pointer-events: none;
// }
</style>

View File

@@ -0,0 +1,393 @@
<template>
<div>
<!--指标越限概率分布 -->
<my-echart
class="tall"
:options="echartList"
:style="{ width: prop.width, height: `calc(${prop.height} / 2 )` }"
/>
<my-echart
class="mt10"
:options="echartList1"
:style="{ width: prop.width, height: `calc(${prop.height} / 2 - 10px)` }"
/>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, provide, reactive, watch, h } from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import MyEchart from '@/components/echarts/MyEchart.vue'
import { useDictData } from '@/stores/dictData'
import { ElMessage, ElMessageBox } from 'element-plus'
import { getTimeOfTheMonth } from '@/utils/formatTime'
const prop = defineProps({
width: { type: String },
height: { type: String },
timeKey: { type: String },
timeValue: { type: Object }
})
const echartList = ref({
options: {
xAxis: null,
yAxis: null,
dataZoom: null,
backgroundColor: '#fff',
tooltip: {
// trigger: 'axis'
textStyle: {
color: '#fff',
fontStyle: 'normal',
opacity: 0.35,
fontSize: 14
},
backgroundColor: 'rgba(0,0,0,0.55)',
borderWidth: 0,
formatter: function (params: any) {
console.log(params)
var tips = ''
for (var i = 0; i < params.length; i++) {
tips += params[i].name + '</br/>'
tips += '监测点数' + ':' + '&nbsp' + '&nbsp' + params[i].value + '</br/>'
}
return tips
}
},
title: {
text: '指标越限概率分布',
x: 'center'
},
visualMap: {
max: 20,
show: false,
inRange: {
color: ['#313695', '#00BB00', '#ff8000', '#a50026']
}
},
xAxis3D: {
type: 'category',
name: '指标越限',
data: ['0-10', '10-20', '20-30', '30-40', '40-50'],
axisLine: {
lineStyle: {
color: '#111'
}
},
axisLabel: {
color: '#111'
}
},
yAxis3D: {
type: 'category',
name: '指标类型',
data: ['闪变', '谐波电压', '谐波电流', '电压偏差', '三相不平衡'],
nameTextStyle: {
color: '#111'
},
axisLine: {
show: true,
lineStyle: {
color: '#111'
}
},
axisLabel: {
color: '#111'
},
splitLine: {
lineStyle: {
// 使用深浅的间隔色
color: ['#111'],
type: 'dashed',
opacity: 0.5
}
}
},
zAxis3D: {
type: 'value',
splitNumber: 10,
minInterval: 10,
name: '越限占比'
},
grid3D: {
viewControl: {
projection: 'perspective',
distance: 250
},
boxWidth: 200,
boxDepth: 80,
light: {
main: {
intensity: 1.2
},
ambient: {
intensity: 0.3
}
}
},
series: [
{
type: 'bar3D',
data: [
[0, 0, 1],
[0, 1, 1],
[0.2, 1]
],
shading: 'realistic',
label: {
show: false,
textStyle: {
fontSize: 16,
borderWidth: 1
}
},
itemStyle: {
opacity: 1
},
emphasis: {
label: {
textStyle: {
fontSize: 20,
color: '#900'
}
},
itemStyle: {
color: '#900'
}
}
}
]
}
})
const echartList1 = ref({
title: {
text: '越限时间概率分布'
},
xAxis: {
// name: '时间',
// data: ['闪变', '谐波电压', '谐波电流', '电压偏差', '三相不平衡']
type: 'time',
axisLabel: {
formatter: {
day: '{MM}-{dd}',
month: '{MM}',
year: '{yyyy}'
}
}
},
yAxis: {
name: '次' // 给X轴加单位
},
grid: {
left: '10px',
right: '20px'
},
options: {
series: [
{
type: 'line',
showSymbol: false,
// smooth: true,
name: '闪变',
data: [
['2025-10-16 07:00:00', 10],
['2025-10-16 07:15:00', 10],
['2025-10-16 07:30:00', 10],
['2025-10-16 07:45:00', 10],
['2025-10-16 08:00:00', 30],
['2025-10-16 08:15:00', 50],
['2025-10-16 08:30:00', 60],
['2025-10-16 08:45:00', 70],
['2025-10-16 09:00:00', 100],
['2025-10-16 09:15:00', 120],
['2025-10-16 09:30:00', 130],
['2025-10-16 09:45:00', 140],
['2025-10-16 10:00:00', 160],
['2025-10-16 10:15:00', 160],
['2025-10-16 10:30:00', 130],
['2025-10-16 10:45:00', 120],
['2025-10-16 11:00:00', 140],
['2025-10-16 11:15:00', 80],
['2025-10-16 11:30:00', 70],
['2025-10-16 11:45:00', 90],
['2025-10-16 12:00:00', 60],
['2025-10-16 12:15:00', 60],
['2025-10-16 12:30:00', 60],
['2025-10-16 12:45:00', 60]
]
},
{
type: 'line',
showSymbol: false,
// smooth: true,
name: '谐波电压',
data: [
['2025-10-16 07:00:00', 1],
['2025-10-16 07:15:00', 1],
['2025-10-16 07:30:00', 1],
['2025-10-16 07:45:00', 1],
['2025-10-16 08:00:00', 3],
['2025-10-16 08:15:00', 5],
['2025-10-16 08:30:00', 6],
['2025-10-16 08:45:00', 7],
['2025-10-16 09:00:00', 10],
['2025-10-16 09:15:00', 12],
['2025-10-16 09:30:00', 13],
['2025-10-16 09:45:00', 14],
['2025-10-16 10:00:00', 16],
['2025-10-16 10:15:00', 16],
['2025-10-16 10:30:00', 13],
['2025-10-16 10:45:00', 12],
['2025-10-16 11:00:00', 14],
['2025-10-16 11:15:00', 8],
['2025-10-16 11:30:00', 7],
['2025-10-16 11:45:00', 9],
['2025-10-16 12:00:00', 6],
['2025-10-16 12:15:00', 6],
['2025-10-16 12:30:00', 6],
['2025-10-16 12:45:00', 6]
]
},
{
type: 'line',
showSymbol: false,
// smooth: true,
name: '谐波电流',
data: [
['2025-10-16 07:00:00', 19],
['2025-10-16 07:15:00', 19],
['2025-10-16 07:30:00', 19],
['2025-10-16 07:45:00', 19],
['2025-10-16 08:00:00', 39],
['2025-10-16 08:15:00', 59],
['2025-10-16 08:30:00', 69],
['2025-10-16 08:45:00', 79],
['2025-10-16 09:00:00', 109],
['2025-10-16 09:15:00', 129],
['2025-10-16 09:30:00', 139],
['2025-10-16 09:45:00', 149],
['2025-10-16 10:00:00', 169],
['2025-10-16 10:15:00', 169],
['2025-10-16 10:30:00', 139],
['2025-10-16 10:45:00', 129],
['2025-10-16 11:00:00', 149],
['2025-10-16 11:15:00', 89],
['2025-10-16 11:30:00', 79],
['2025-10-16 11:45:00', 99],
['2025-10-16 12:00:00', 69],
['2025-10-16 12:15:00', 69],
['2025-10-16 12:30:00', 69],
['2025-10-16 12:45:00', 69]
]
},
{
type: 'line',
showSymbol: false,
// smooth: true,
name: '电压偏差',
data: [
['2025-10-16 07:00:00', 12],
['2025-10-16 07:15:00', 12],
['2025-10-16 07:30:00', 12],
['2025-10-16 07:45:00', 12],
['2025-10-16 08:00:00', 32],
['2025-10-16 08:15:00', 52],
['2025-10-16 08:30:00', 62],
['2025-10-16 08:45:00', 72],
['2025-10-16 09:00:00', 112],
['2025-10-16 09:15:00', 122],
['2025-10-16 09:30:00', 122],
['2025-10-16 09:45:00', 152],
['2025-10-16 10:00:00', 122],
['2025-10-16 10:15:00', 112],
['2025-10-16 10:30:00', 132],
['2025-10-16 10:45:00', 122],
['2025-10-16 11:00:00', 142],
['2025-10-16 11:15:00', 82],
['2025-10-16 11:30:00', 72],
['2025-10-16 11:45:00', 92],
['2025-10-16 12:00:00', 62],
['2025-10-16 12:15:00', 62],
['2025-10-16 12:30:00', 62],
['2025-10-16 12:45:00', 62]
]
},
{
type: 'line',
showSymbol: false,
// smooth: true,
name: '三相不平衡',
data: [
['2025-10-16 07:00:00', 10],
['2025-10-16 07:15:00', 10],
['2025-10-16 07:30:00', 10],
['2025-10-16 07:45:00', 10],
['2025-10-16 08:00:00', 30],
['2025-10-16 08:15:00', 50],
['2025-10-16 08:30:00', 60],
['2025-10-16 08:45:00', 70],
['2025-10-16 09:00:00', 100],
['2025-10-16 09:15:00', 120],
['2025-10-16 09:30:00', 130],
['2025-10-16 09:45:00', 140],
['2025-10-16 10:00:00', 160],
['2025-10-16 10:15:00', 160],
['2025-10-16 10:30:00', 130],
['2025-10-16 10:45:00', 120],
['2025-10-16 11:00:00', 140],
['2025-10-16 11:15:00', 80],
['2025-10-16 11:30:00', 70],
['2025-10-16 11:45:00', 90],
['2025-10-16 12:00:00', 60],
['2025-10-16 12:15:00', 60],
['2025-10-16 12:30:00', 60],
['2025-10-16 12:45:00', 60]
]
}
]
}
})
const tableStore: any = new TableStore({
url: '/user-boot/dept/deptTree',
method: 'POST',
showPage: false,
column: [],
beforeSearchFun: () => {
tableStore.table.params.searchBeginTime = prop.timeValue?.[0] || getTimeOfTheMonth(prop.timeKey)[0]
tableStore.table.params.searchEndTime = prop.timeValue?.[1] || getTimeOfTheMonth(prop.timeKey)[1]
},
loadCallback: () => {
tableStore.table.data = []
}
})
const tableRef = ref()
provide('tableRef', tableRef)
provide('tableStore', tableStore)
onMounted(() => {
tableStore.index()
})
watch(
() => prop.timeKey,
val => {
tableStore.index()
}
)
watch(
() => prop.timeValue, // 监听的目标(函数形式避免直接传递 props 导致的警告)
(newVal, oldVal) => {
tableStore.index()
},
{
deep: true // 若 timeValue 是对象/数组,需开启深度监听
}
)
const addMenu = () => {}
</script>
<style lang="scss" scoped></style>

View File

@@ -0,0 +1,145 @@
<template>
<div>
<!--主要监测点列表 -->
<TableHeader :showReset="false" >
<template v-slot:select>
<el-form-item label="关键词">
<el-input v-model="tableStore.table.params.searchValue" clearable placeholder="请输关键字" />
</el-form-item>
</template>
</TableHeader>
<Table ref="tableRef" @cell-click="cellClickEvent" :height="`calc(${prop.height} - 58px)`"></Table>
<!-- 指标越限详情 -->
<OverLimitDetails ref="OverLimitDetailsRef" />
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, provide, reactive, watch, h } from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import TableHeader from '@/components/table/header/index.vue'
import { useDictData } from '@/stores/dictData'
import { ElMessage, ElMessageBox } from 'element-plus'
import { getTimeOfTheMonth } from '@/utils/formatTime'
import { ElTag } from 'element-plus'
import OverLimitDetails from '@/components/cockpit/listOfMainMonitoringPoints/components/overLimitDetails.vue'
const prop = defineProps({
width: { type: String },
height: { type: String },
timeKey: { type: String },
timeValue: { type: Object }
})
const dictData = useDictData()
const OverLimitDetailsRef = ref()
const tableStore: any = new TableStore({
url: '/user-boot/role/selectRoleDetail?id=0',
method: 'POST',
showPage: false,
exportName: '主要监测点列表',
column: [
{
field: 'index',
title: '序号',
width: '60',
formatter: (row: any) => {
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
}
},
{
title: '监测点名称',
field: 'name',
minWidth: '90',
render: 'customTemplate',
customTemplate: (row: any) => {
return `<span style='cursor: pointer;text-decoration: underline;'>${row.name}</span>`
}
},
{
title: '监测对象类型',
field: 'type',
minWidth: '90'
},
{
title: '是否治理',
field: 'whetherToGovern',
minWidth: '70'
},
{ title: '主要存在的电能质量问题', field: 'question', minWidth: '150' }
],
beforeSearchFun: () => {
tableStore.table.params.searchBeginTime = prop.timeValue?.[0] || getTimeOfTheMonth(prop.timeKey)[0]
tableStore.table.params.searchEndTime = prop.timeValue?.[1] || getTimeOfTheMonth(prop.timeKey)[1]
},
loadCallback: () => {
tableStore.table.data = [
{
name: '10kV1#电动机',
type: '电动机',
whetherToGovern: '否',
question: '3次谐波电压、5次谐波电流、电压不平衡度超标'
},
{
name: '10kV2#(治理后)',
type: '电焊机',
whetherToGovern: '100A APF',
question: '所有指标均合格'
},
{
name: '380V电焊机(治理前)',
type: '电焊机',
whetherToGovern: '100A APF',
question: '5次谐波电流、电压不平衡度超标'
},
{
name: '380V水泵机',
type: '电动机',
whetherToGovern: '否',
question: '所有指标均合格'
}
]
tableStore.table.height = `calc(${prop.height} - 80px)`
}
})
const tableRef = ref()
provide('tableRef', tableRef)
tableStore.table.params.type = ''
tableStore.table.params.searchValue = ''
provide('tableStore', tableStore)
// 点击行
const cellClickEvent = ({ row, column }: any) => {
if (column.field == 'name') {
console.log(row)
OverLimitDetailsRef.value.open(row)
}
}
onMounted(() => {
tableStore.index()
})
watch(
() => prop.timeKey,
val => {
tableStore.index()
}
)
watch(
() => prop.timeValue, // 监听的目标(函数形式避免直接传递 props 导致的警告)
(newVal, oldVal) => {
tableStore.index()
},
{
deep: true // 若 timeValue 是对象/数组,需开启深度监听
}
)
const addMenu = () => {}
</script>
<style lang="scss" scoped></style>

View File

@@ -0,0 +1,134 @@
<template>
<!-- 综合评估详情 -->
<el-dialog draggable title="指标合格率统计" v-model="dialogVisible" append-to-body width="70%">
<TableHeader datePicker showExport :showReset="false">
<template v-slot:select>
<el-form-item label="监测点名称">
<el-select
v-model="tableStore.table.params.searchValue"
placeholder="请选择监测点名称"
style="width: 240px"
>
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
</template>
</TableHeader>
<Table ref="tableRef" isGroup :height="height"></Table>
</el-dialog>
</template>
<script setup lang="ts">
import { ref, provide } from 'vue'
import Table from '@/components/table/index.vue'
import TableHeader from '@/components/table/header/index.vue'
import TableStore from '@/utils/tableStore'
import { mainHeight } from '@/utils/layout'
const dialogVisible: any = ref(false)
const options = [
{
value: '35kV进线',
label: '35kV进线'
}
]
const height = mainHeight(0, 2).height as any
const loop50 = (key: string) => {
let list: any[] = []
for (let i = 2; i < 51; i++) {
list.push({
title: i + '次',
// field: key + i,
field: 'flicker',
width: '80'
})
}
return list
}
const tableStore: any = new TableStore({
url: '/user-boot/role/selectRoleDetail?id=0',
method: 'POST',
publicHeight: 30,
showPage: false,
exportName: '主要监测点列表',
column: [
{
field: 'index',
title: '序号',
width: '60',
formatter: (row: any) => {
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
}
},
{
title: '日期',
field: 'time',
width: '150'
},
{
title: '名称',
field: 'name',
width: '150'
},
{
title: '闪变越限(分钟)',
field: 'flicker',
width: '80'
},
{
title: '谐波电压越限(分钟)',
children: loop50('voltage')
},
{
title: '谐波电流越限(分钟)',
children: loop50('harmonicCurrent')
},
{
title: '三相不平衡度越限(分钟)',
field: 'flicker',
width: '100'
},
{
title: '电压偏差越限(分钟)',
field: 'flicker',
width: '100'
},
{
title: '频率偏差越限(分钟)',
field: 'flicker',
width: '100'
}
],
beforeSearchFun: () => {},
loadCallback: () => {
tableStore.table.data = [
{
time: '2024-01-01 00:00:00',
name: '35kV进线',
flicker: '0',
},
{
time: '2024-01-01 00:00:00',
name: '35kV进线',
flicker: '0',
},
{
time: '2024-01-01 00:00:00',
name: '35kV进线',
flicker: '0',
},
]
}
})
tableStore.table.params.searchValue = ''
provide('tableStore', tableStore)
const open = async (row: any) => {
dialogVisible.value = true
tableStore.index()
}
defineExpose({ open })
</script>
<style lang="scss" scoped></style>

View File

@@ -0,0 +1,271 @@
<template>
<div>
<!--指标拟合图 -->
<TableHeader :showReset="false" @selectChange="selectChange">
<template v-slot:select>
<el-form-item label="用户功率">
<el-select
v-model="tableStore.table.params.power"
placeholder="请选择用户功率"
clearable
style="width: 130px"
>
<el-option
v-for="item in powerList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="电能质量指标">
<el-select
v-model="tableStore.table.params.indicator"
placeholder="请选择电能质量指标"
clearable
style="width: 130px"
>
<el-option
v-for="item in indicatorList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="越限情况">
<el-select
v-model="tableStore.table.params.exceedingTheLimit"
placeholder="请选择越限情况"
clearable
style="width: 90px"
>
<el-option
v-for="item in exceedingTheLimitList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</template>
</TableHeader>
<my-echart
class="tall"
:options="echartList"
:style="{ width: prop.width, height: `calc(${prop.height} - ${headerHeight}px )` }"
/>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, provide, reactive, watch, h } from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import TableHeader from '@/components/table/header/index.vue'
import { useDictData } from '@/stores/dictData'
import { ElMessage, ElMessageBox } from 'element-plus'
import { getTimeOfTheMonth } from '@/utils/formatTime'
import MyEchart from '@/components/echarts/MyEchart.vue'
import { useConfig } from '@/stores/config'
const prop = defineProps({
width: { type: String },
height: { type: String },
timeKey: { type: String },
timeValue: { type: Object }
})
const config = useConfig()
const powerList: any = ref([
{
label: '三相总有功功率',
value: '1'
},
{
label: '三相总无功功率',
value: '2'
}
])
const exceedingTheLimitList: any = ref([
{
label: '越限',
value: '1'
},
{
label: '不越限',
value: '0'
}
])
const indicatorList: any = ref([
{
label: '谐波电压总畸变率',
value: '1'
},
{
label: '各次谐波电压',
value: '2'
},
{
label: '各次谐波电压',
value: '3'
},
{
label: '三相电压不平衡',
value: '4'
}
])
const echartList = ref({
title: {
text: '谐波电压总畸变率越限与功率负荷曲线拟合图'
},
xAxis: {
type: 'time',
axisLabel: {
formatter: {
day: '{MM}-{dd}',
month: '{MM}',
year: '{yyyy}'
}
}
},
yAxis: [{}, {}],
grid: {
left: '10px',
right: '20px'
},
options: {
series: [
{
// name: '暂降次数',
type: 'bar',
name: '有功功率',
data: [
['2025-10-16 07:00:00', 10],
['2025-10-16 07:15:00', 10],
['2025-10-16 07:30:00', 10],
['2025-10-16 07:45:00', 10],
['2025-10-16 08:00:00', 30],
['2025-10-16 08:15:00', 50],
['2025-10-16 08:30:00', 60],
['2025-10-16 08:45:00', 70],
['2025-10-16 09:00:00', 100],
['2025-10-16 09:15:00', 120],
['2025-10-16 09:30:00', 130],
['2025-10-16 09:45:00', 140],
['2025-10-16 10:00:00', 160],
['2025-10-16 10:15:00', 160],
['2025-10-16 10:30:00', 130],
['2025-10-16 10:45:00', 120],
['2025-10-16 11:00:00', 140],
['2025-10-16 11:15:00', 80],
['2025-10-16 11:30:00', 70],
['2025-10-16 11:45:00', 90],
['2025-10-16 12:00:00', 60],
['2025-10-16 12:15:00', 60],
['2025-10-16 12:30:00', 60],
['2025-10-16 12:45:00', 60]
],
itemStyle: {
normal: {
//这里是颜色
color: function (params: any) {
if (params.value[1] == 0 || params.value[1] == 3.14159) {
return '#ccc'
} else {
return config.layout.elementUiPrimary[0]
}
}
}
},
yAxisIndex: 0
},
{
name: '谐波总畸变率',
type: 'line',
showSymbol: false,
smooth: true,
data: [
['2025-10-16 07:00:00', 0],
['2025-10-16 07:15:00', 0],
['2025-10-16 07:30:00', 0],
['2025-10-16 07:45:00', 0],
['2025-10-16 08:00:00', 0],
['2025-10-16 08:15:00', 0.1],
['2025-10-16 08:30:00', 0.1],
['2025-10-16 08:45:00', 0.1],
['2025-10-16 09:00:00', 1],
['2025-10-16 09:15:00', 1],
['2025-10-16 09:30:00', 1],
['2025-10-16 09:45:00', 1],
['2025-10-16 10:00:00', 0.8],
['2025-10-16 10:15:00', 0.8],
['2025-10-16 10:30:00', 0.8],
['2025-10-16 10:45:00', 0.8],
['2025-10-16 11:00:00', 0.8],
['2025-10-16 11:15:00', 0.1],
['2025-10-16 11:30:00', 0.1],
['2025-10-16 11:45:00', 0.1],
['2025-10-16 12:00:00', 0],
['2025-10-16 12:15:00', 0],
['2025-10-16 12:30:00', 0],
['2025-10-16 12:45:00', 0]
],
yAxisIndex: 1
}
]
}
})
const headerHeight = ref(57)
const selectChange = (showSelect: any, height: any) => {
headerHeight.value = height
}
const tableStore: any = new TableStore({
url: '/user-boot/role/selectRoleDetail?id=0',
method: 'POST',
showPage: false,
exportName: '主要监测点列表',
column: [],
beforeSearchFun: () => {
tableStore.table.params.searchBeginTime = prop.timeValue?.[0] || getTimeOfTheMonth(prop.timeKey)[0]
tableStore.table.params.searchEndTime = prop.timeValue?.[1] || getTimeOfTheMonth(prop.timeKey)[1]
},
loadCallback: () => {
tableStore.table.height = `calc(${prop.height} - 80px)`
}
})
const tableRef = ref()
provide('tableRef', tableRef)
tableStore.table.params.power = '1'
tableStore.table.params.indicator = '1'
tableStore.table.params.exceedingTheLimit = '1'
tableStore.table.params.searchValue = ''
provide('tableStore', tableStore)
onMounted(() => {
tableStore.index()
})
watch(
() => prop.timeKey,
val => {
tableStore.index()
}
)
watch(
() => prop.timeValue, // 监听的目标(函数形式避免直接传递 props 导致的警告)
(newVal, oldVal) => {
tableStore.index()
},
{
deep: true // 若 timeValue 是对象/数组,需开启深度监听
}
)
const addMenu = () => {}
</script>
<style lang="scss" scoped>
:deep(.el-select) {
min-width: 80px;
}
</style>

View File

@@ -0,0 +1,169 @@
<template>
<div>
<!--监测点列表 -->
<Table ref="tableRef" @cell-click="cellClickEvent" :height="`calc(${prop.height} )`"></Table>
<!-- 指标越限详情 -->
<OverLimitDetails ref="OverLimitDetailsRef" />
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, provide, reactive, watch, h } from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import TableHeader from '@/components/table/header/index.vue'
import { useDictData } from '@/stores/dictData'
import { ElMessage, ElMessageBox } from 'element-plus'
import { getTimeOfTheMonth } from '@/utils/formatTime'
import { ElTag } from 'element-plus'
import OverLimitDetails from '@/components/cockpit/listOfMainMonitoringPoints/components/overLimitDetails.vue'
const prop = defineProps({
width: { type: String },
height: { type: String },
timeKey: { type: String },
timeValue: { type: Object }
})
const dictData = useDictData()
const OverLimitDetailsRef = ref()
const tableStore: any = new TableStore({
url: '/user-boot/role/selectRoleDetail?id=0',
method: 'POST',
showPage: false,
exportName: '主要监测点列表',
column: [
{
field: 'index',
title: '序号',
width: '60',
formatter: (row: any) => {
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
}
},
{
title: '治理对象名称',
field: 'name',
minWidth: '80'
},
{
title: '电压等级',
field: 'type',
minWidth: '70'
},
{
title: '治理设备详情',
field: 'type1',
minWidth: '70'
},
{
title: '治理前报告',
field: 'type2',
minWidth: '80',
render: 'customTemplate',
customTemplate: (row: any) => {
return `<span style='cursor: pointer;text-decoration: underline;'>${row.type2}</span>`
}
},
{ title: '监测点名称', field: 'type3', minWidth: '70' },
{ title: '监测类型', field: 'type4', minWidth: '60' },
{
title: '监测点状态',
field: 'type5',
minWidth: '60',
render: 'customTemplate',
customTemplate: (row: any) => {
return `<span style='color: ${row.type5 === '中断' ? '#FF0000' : ''}'>${row.type5}</span>`
}
},
{ title: '最新数据时间', field: 'type6', minWidth: '140' }
],
beforeSearchFun: () => {
tableStore.table.params.searchBeginTime = prop.timeValue?.[0] || getTimeOfTheMonth(prop.timeKey)[0]
tableStore.table.params.searchEndTime = prop.timeValue?.[1] || getTimeOfTheMonth(prop.timeKey)[1]
},
loadCallback: () => {
tableStore.table.data = [
{
name: '1#变压器',
type: '0.38kV',
type1: '250A APF',
type2: '报告.doc',
type3: '1#变压器 电网侧',
type4: '电网侧',
type5: '运行',
type6: '2025-04-11 18:16:00'
},
{
name: '1#变压器',
type: '0.38kV',
type1: '250A APF',
type2: '报告.doc',
type3: '1#变压器 负载侧',
type4: '负载侧',
type5: '运行',
type6: '2025-04-11 18:16:00'
},
{
name: '2#变压器',
type: '0.38kV',
type1: '100A SVG',
type2: '/',
type3: '1#变压器 电网侧',
type4: '电网侧',
type5: '运行',
type6: '2025-04-11 18:16:00'
},
{
name: '2#变压器',
type: '0.38kV',
type1: '100A SVG',
type2: '/',
type3: '1#变压器 负载侧',
type4: '负载侧',
type5: '中断',
type6: '2025-04-11 18:16:00'
}
]
tableStore.table.height = `calc(${prop.height} - 80px)`
}
})
const tableRef = ref()
provide('tableRef', tableRef)
tableStore.table.params.type = ''
tableStore.table.params.searchValue = ''
provide('tableStore', tableStore)
// 点击行
const cellClickEvent = ({ row, column }: any) => {
if (column.field == 'name') {
console.log(row)
OverLimitDetailsRef.value.open(row)
}
}
onMounted(() => {
tableStore.index()
})
watch(
() => prop.timeKey,
val => {
tableStore.index()
}
)
watch(
() => prop.timeValue, // 监听的目标(函数形式避免直接传递 props 导致的警告)
(newVal, oldVal) => {
tableStore.index()
},
{
deep: true // 若 timeValue 是对象/数组,需开启深度监听
}
)
const addMenu = () => {}
</script>
<style lang="scss" scoped></style>

View File

@@ -0,0 +1,196 @@
<template>
<div>
<!--总体指标越限统计 -->
<my-echart
class="tall"
:options="echartList"
:style="{ width: prop.width, height: `calc(${prop.height} / 2 )` }"
/>
<Table ref="tableRef" @cell-click="cellClickEvent" :height="`calc(${prop.height} / 2 )`" isGroup></Table>
<!-- 指标越限详情 -->
<OverLimitDetails ref="OverLimitDetailsRef" />
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, provide, reactive, watch, h } from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import MyEchart from '@/components/echarts/MyEchart.vue'
import { useDictData } from '@/stores/dictData'
import { ElMessage, ElMessageBox } from 'element-plus'
import { getTimeOfTheMonth } from '@/utils/formatTime'
import OverLimitDetails from '@/components/cockpit/listOfMainMonitoringPoints/components/overLimitDetails.vue'
const prop = defineProps({
width: { type: String },
height: { type: String },
timeKey: { type: String },
timeValue: { type: Object }
})
const echartList = ref({
title: {
text: '指标越限占比'
},
xAxis: {
// name: '(区域)',
data: ['闪变', '谐波电压', '谐波电流', '电压偏差', '三相不平衡']
},
yAxis: {
name: '%', // 给X轴加单位
interval: 20
},
grid: {
left: '10px',
right: '20px'
},
options: {
series: [
{
// name: '暂降次数',
type: 'bar',
name: '越限占比',
data: [0, 45, 22, 0, 70],
barMaxWidth: 30,
// label: {
// show: true,
// position: 'top',
// textStyle: {
// //数值样式
// color: '#000'
// },
// fontSize: 12
// }
}
]
}
})
const OverLimitDetailsRef = ref()
const tableStore: any = new TableStore({
url: '/user-boot/dept/deptTree',
method: 'POST',
showPage: false,
column: [
{
field: 'index',
title: '序号',
width: '60',
formatter: (row: any) => {
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
}
},
{
title: '名称',
field: 'name',
minWidth: '90'
},
{
title: '越限占比(%)',
children: [
{
title: '闪变',
field: 'type',
minWidth: '70',
render: 'customTemplate',
customTemplate: (row: any) => {
return `<span style='cursor: pointer;text-decoration: underline;'>${row.type}</span>`
}
},
{
title: '谐波电压',
field: 'type1',
minWidth: '80',
render: 'customTemplate',
customTemplate: (row: any) => {
return `<span style='cursor: pointer;text-decoration: underline;'>${row.type1}</span>`
}
},
{
title: '谐波电流',
field: 'type2',
minWidth: '80',
render: 'customTemplate',
customTemplate: (row: any) => {
return `<span style='cursor: pointer;text-decoration: underline;'>${row.type2}</span>`
}
},
{
title: '电压偏差',
field: 'type3',
minWidth: '80',
render: 'customTemplate',
customTemplate: (row: any) => {
return `<span style='cursor: pointer;text-decoration: underline;'>${row.type3}</span>`
}
},
{
title: '三相不平衡',
field: 'type4',
minWidth: '90',
render: 'customTemplate',
customTemplate: (row: any) => {
return `<span style='cursor: pointer;text-decoration: underline;'>${row.type4}</span>`
}
}
]
}
],
beforeSearchFun: () => {
tableStore.table.params.searchBeginTime = prop.timeValue?.[0] || getTimeOfTheMonth(prop.timeKey)[0]
tableStore.table.params.searchEndTime = prop.timeValue?.[1] || getTimeOfTheMonth(prop.timeKey)[1]
},
loadCallback: () => {
tableStore.table.data = [
{
name: '10kV1#电动机',
type: '0',
type1: '45',
type2: '22',
type3: '0',
type4: '70'
}
]
tableStore.table.height = `calc(${prop.height} - 80px)`
}
})
const tableRef = ref()
provide('tableRef', tableRef)
provide('tableStore', tableStore)
// 点击行
const cellClickEvent = ({ row, column }: any) => {
if (column.field != 'name') {
console.log(row)
OverLimitDetailsRef.value.open(row)
}
}
onMounted(() => {
tableStore.index()
})
watch(
() => prop.timeKey,
val => {
tableStore.index()
}
)
watch(
() => prop.timeValue, // 监听的目标(函数形式避免直接传递 props 导致的警告)
(newVal, oldVal) => {
tableStore.index()
},
{
deep: true // 若 timeValue 是对象/数组,需开启深度监听
}
)
const addMenu = () => {}
</script>
<style lang="scss" scoped></style>

View File

@@ -0,0 +1,119 @@
<template>
<div>
<!--敏感负荷列表 -->
<Table ref="tableRef" @cell-click="cellClickEvent" :height="`calc(${prop.height})`" isGroup></Table>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, provide, reactive, watch, h } from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import MyEchart from '@/components/echarts/MyEchart.vue'
import { useDictData } from '@/stores/dictData'
import { ElMessage, ElMessageBox } from 'element-plus'
import { getTimeOfTheMonth } from '@/utils/formatTime'
const prop = defineProps({
width: { type: String },
height: { type: String },
timeKey: { type: String },
timeValue: { type: Object }
})
const OverLimitDetailsRef = ref()
const tableStore: any = new TableStore({
url: '/user-boot/dept/deptTree',
method: 'POST',
showPage: false,
column: [
{
field: 'index',
title: '序号',
width: '60',
formatter: (row: any) => {
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
}
},
{
title: '敏感负荷名称',
field: 'name',
minWidth: '90'
},
{
title: '敏感负荷类型',
field: 'type',
minWidth: '70'
},
{
title: '是否监测',
field: 'type1',
minWidth: '80'
},
{
title: '是否治理',
field: 'type2',
minWidth: '80'
}
],
beforeSearchFun: () => {
tableStore.table.params.searchBeginTime = prop.timeValue?.[0] || getTimeOfTheMonth(prop.timeKey)[0]
tableStore.table.params.searchEndTime = prop.timeValue?.[1] || getTimeOfTheMonth(prop.timeKey)[1]
},
loadCallback: () => {
tableStore.table.data = [
{
name: '10kV1#变压器',
type: '机房',
type1: '是',
type2: '100A APF'
},
{
name: '380kV1#母线',
type: 'PLC',
type1: '是',
type2: 'UPS'
}
]
}
})
const tableRef = ref()
provide('tableRef', tableRef)
provide('tableStore', tableStore)
// 点击行
const cellClickEvent = ({ row, column }: any) => {
if (column.field != 'name') {
console.log(row)
OverLimitDetailsRef.value.open(row)
}
}
onMounted(() => {
setTimeout(() => {
tableStore.index()
}, 500)
})
watch(
() => prop.timeKey,
val => {
tableStore.index()
}
)
watch(
() => prop.timeValue, // 监听的目标(函数形式避免直接传递 props 导致的警告)
(newVal, oldVal) => {
tableStore.index()
},
{
deep: true // 若 timeValue 是对象/数组,需开启深度监听
}
)
const addMenu = () => {}
</script>
<style lang="scss" scoped></style>

View File

@@ -0,0 +1,199 @@
<template>
<div>
<!--暂态事件明细 -->
<el-calendar v-model="value" :style="{ height: prop.height, overflow: 'auto' }">
<template #date-cell="{ data }">
<div style="height: 100%; padding: 8px" :style="{ background: setBackground(data.day) }">
<p :class="data.isSelected ? 'is-selected' : ''">
{{ data.day.split('-').slice(2).join('-') }}
</p>
<el-tooltip
effect="dark"
placement="top"
:hide-after="0"
v-if="list?.filter(item => item.time == data.day)[0]?.type || false"
>
<template #content>
<!-- <span v-html="list?.filter(item => item.time == data.day)[0]?.type || ''"></span> -->
<div v-for="item in list?.filter(item => item.time == data.day)">
<div>电压暂降{{ item.type || '' }}</div>
<div>电压中断{{ item.type1 || '' }}</div>
<div>电压暂升{{ item.type2 || '' }}</div>
</div>
</template>
<div
:style="{ height: `calc(${prop.height} / 5 - 47px)`, overflow: 'auto' }"
v-for="item in list?.filter(item => item.time == data.day)"
>
<div>电压暂降:{{ item.type || '' }}</div>
<div>电压中断:{{ item.type1 || '' }}</div>
<div>电压暂升:{{ item.type2 || '' }}</div>
</div>
</el-tooltip>
</div>
</template>
</el-calendar>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, provide, reactive, watch, h } from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import { useDictData } from '@/stores/dictData'
import { ElMessage, ElMessageBox } from 'element-plus'
import { getTimeOfTheMonth } from '@/utils/formatTime'
import { overflow } from 'html2canvas/dist/types/css/property-descriptors/overflow'
import { dayjs } from 'element-plus'
dayjs.en.weekStart = 1 //设置日历的周起始日为星期一
const value = ref(new Date())
const prop = defineProps({
width: { type: String },
height: { type: String },
timeKey: { type: String },
timeValue: { type: Object }
})
const list = ref([
{
time: '2025-10-01',
key: 81,
type: 1,
type1: 1,
type2: 1
},
{
time: '2025-10-31',
key: 81,
type: 1,
type1: 1,
type2: 1
},
{
time: '2025-10-08',
key: 20,
type: 1,
type1: 1,
type2: 1
},
{
time: '2025-10-16',
key: 20,
type: 1,
type1: 1,
type2: 1
},
{
time: '2025-10-23',
key: 20,
type: 1,
type1: 1,
type2: 1
},
{
time: '2025-10-04',
key: 0
},
{
time: '2025-10-05',
key: 0
}
])
const tableStore: any = new TableStore({
url: '/user-boot/dept/deptTree',
method: 'POST',
showPage: false,
column: [],
beforeSearchFun: () => {
tableStore.table.params.searchBeginTime = prop.timeValue?.[0] || getTimeOfTheMonth(prop.timeKey)[0]
tableStore.table.params.searchEndTime = prop.timeValue?.[1] || getTimeOfTheMonth(prop.timeKey)[1]
// value.value = new Date(prop.timeValue?.[0])
},
loadCallback: () => {
tableStore.table.data = []
}
})
const tableRef = ref([])
const setBackground = (value: string) => {
let data = []
data = list.value?.filter(item => item.time == value)
if (data && data?.length > 0) {
if (data[0].key > 0) {
return '#Ff660090'
}
}
return '#fff'
}
provide('tableRef', tableRef)
provide('tableStore', tableStore)
onMounted(() => {
tableStore.index()
})
watch(
() => prop.timeKey,
val => {
tableStore.index()
}
)
watch(
() => prop.timeValue, // 监听的目标(函数形式避免直接传递 props 导致的警告)
(newVal, oldVal) => {
tableStore.index()
},
{
deep: true // 若 timeValue 是对象/数组,需开启深度监听
}
)
const addMenu = () => {}
</script>
<style lang="scss" scoped>
:deep(.el-calendar) {
.el-calendar__header {
display: none;
}
.el-calendar__body {
padding: 0px !important;
height: 100%;
.el-calendar-table {
height: 100%;
}
}
.el-calendar-day {
height: 100%;
padding: 0px;
overflow: hidden;
}
.el-calendar-table__row {
.next {
pointer-events: none;
}
.prev {
pointer-events: none;
}
}
.el-calendar-table .el-calendar-day:hover {
background-color: #ffffff00;
}
.el-calendar-table td.is-selected {
background-color: #ffffff00;
}
}
// /*calendar_class 是el-calendar所在父标签的css*/
// .calendar_class >>> .el-calendar-table:not(.is-range) td.next {
// pointer-events: none;
// }
// .calendar_class >>> .el-calendar-table:not(.is-range) td.prev {
// pointer-events: none;
// }
</style>

View File

@@ -0,0 +1,345 @@
<template>
<div>
<!--暂态事件概率分布 -->
<my-echart
class="tall"
:options="echartList"
:style="{ width: prop.width, height: `calc(${prop.height} / 2 )` }"
/>
<my-echart
class="mt10"
:options="echartList1"
:style="{ width: prop.width, height: `calc(${prop.height} / 2 - 10px)` }"
/>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, provide, reactive, watch, h } from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import MyEchart from '@/components/echarts/MyEchart.vue'
import { useDictData } from '@/stores/dictData'
import { ElMessage, ElMessageBox } from 'element-plus'
import { getTimeOfTheMonth } from '@/utils/formatTime'
import { useConfig } from '@/stores/config'
const config = useConfig()
const prop = defineProps({
width: { type: String },
height: { type: String },
timeKey: { type: String },
timeValue: { type: Object }
})
const echartList = ref({
options: {
xAxis: null,
yAxis: null,
dataZoom: null,
backgroundColor: '#fff',
tooltip: {
// trigger: 'axis'
textStyle: {
color: '#fff',
fontStyle: 'normal',
opacity: 0.35,
fontSize: 14
},
backgroundColor: 'rgba(0,0,0,0.55)',
borderWidth: 0,
formatter: function (params: any) {
console.log(params)
var tips = ''
for (var i = 0; i < params.length; i++) {
tips += params[i].name + '</br/>'
tips += '监测点数' + ':' + '&nbsp' + '&nbsp' + params[i].value + '</br/>'
}
return tips
}
},
title: {
text: '暂态事件概率分布',
x: 'center'
},
visualMap: {
max: 20,
show: false,
inRange: {
color: ['#313695', '#00BB00', '#ff8000', '#a50026']
}
},
xAxis3D: {
type: 'category',
name: '特征幅值',
data: [
'0-10%',
'10%-20%',
'20%-30%',
'30%-40%',
'40%-50%',
'50%-60%',
'60%-70%',
'70%-80%',
'80%-90%',
'90%-100%'
],
axisLine: {
lineStyle: {
color: '#111'
}
},
axisLabel: {
color: '#111'
}
},
yAxis3D: {
type: 'category',
name: '持续时间',
data: ['0-0.01s', '0.01s-0.1s', '0.1s-1s', '1s-10s', '10s'],
nameTextStyle: {
color: '#111'
},
axisLine: {
show: true,
lineStyle: {
color: '#111'
}
},
axisLabel: {
color: '#111'
},
splitLine: {
lineStyle: {
// 使用深浅的间隔色
color: ['#111'],
type: 'dashed',
opacity: 0.5
}
}
},
zAxis3D: {
type: 'value',
splitNumber: 10,
minInterval: 10,
name: '暂态事件次数'
},
grid3D: {
viewControl: {
projection: 'perspective',
distance: 250
},
boxWidth: 200,
boxDepth: 80,
light: {
main: {
intensity: 1.2
},
ambient: {
intensity: 0.3
}
}
},
series: [
{
type: 'bar3D',
data: [
[0, 0, 1],
[0, 1, 1],
[0.2, 1]
],
shading: 'realistic',
label: {
show: false,
textStyle: {
fontSize: 16,
borderWidth: 1
}
},
itemStyle: {
opacity: 1
},
emphasis: {
label: {
textStyle: {
fontSize: 20,
color: '#900'
}
},
itemStyle: {
color: '#900'
}
}
}
]
}
})
const echartList1 = ref({
title: {
text: '越限时间概率分布'
},
xAxis: {
// name: '时间',
// data: ['闪变', '谐波电压', '谐波电流', '电压偏差', '三相不平衡']
type: 'time',
axisLabel: {
formatter: {
day: '{MM}-{dd}',
month: '{MM}',
year: '{yyyy}'
}
}
},
yAxis: {
name: '次' // 给X轴加单位
},
grid: {
left: '10px',
right: '20px'
},
options: {
series: [
{
type: 'line',
showSymbol: false,
// smooth: true,
name: '电压中断',
color: '#FF9100',
data: [
['2025-10-16 07:00:00', 10],
['2025-10-16 07:15:00', 10],
['2025-10-16 07:30:00', 10],
['2025-10-16 07:45:00', 10],
['2025-10-16 08:00:00', 30],
['2025-10-16 08:15:00', 50],
['2025-10-16 08:30:00', 60],
['2025-10-16 08:45:00', 70],
['2025-10-16 09:00:00', 100],
['2025-10-16 09:15:00', 120],
['2025-10-16 09:30:00', 130],
['2025-10-16 09:45:00', 140],
['2025-10-16 10:00:00', 160],
['2025-10-16 10:15:00', 160],
['2025-10-16 10:30:00', 130],
['2025-10-16 10:45:00', 120],
['2025-10-16 11:00:00', 140],
['2025-10-16 11:15:00', 80],
['2025-10-16 11:30:00', 70],
['2025-10-16 11:45:00', 90],
['2025-10-16 12:00:00', 60],
['2025-10-16 12:15:00', 60],
['2025-10-16 12:30:00', 60],
['2025-10-16 12:45:00', 60]
]
},
{
type: 'line',
showSymbol: false,
// smooth: true,
color: '#FFBF00',
name: '电压暂降',
data: [
['2025-10-16 07:00:00', 1],
['2025-10-16 07:15:00', 1],
['2025-10-16 07:30:00', 1],
['2025-10-16 07:45:00', 1],
['2025-10-16 08:00:00', 3],
['2025-10-16 08:15:00', 5],
['2025-10-16 08:30:00', 6],
['2025-10-16 08:45:00', 7],
['2025-10-16 09:00:00', 10],
['2025-10-16 09:15:00', 12],
['2025-10-16 09:30:00', 13],
['2025-10-16 09:45:00', 14],
['2025-10-16 10:00:00', 16],
['2025-10-16 10:15:00', 16],
['2025-10-16 10:30:00', 13],
['2025-10-16 10:45:00', 12],
['2025-10-16 11:00:00', 14],
['2025-10-16 11:15:00', 8],
['2025-10-16 11:30:00', 7],
['2025-10-16 11:45:00', 9],
['2025-10-16 12:00:00', 6],
['2025-10-16 12:15:00', 6],
['2025-10-16 12:30:00', 6],
['2025-10-16 12:45:00', 6]
]
},
{
type: 'line',
showSymbol: false,
// smooth: true,
name: '电压暂升',
color: config.layout.elementUiPrimary[0],
data: [
['2025-10-16 07:00:00', 19],
['2025-10-16 07:15:00', 19],
['2025-10-16 07:30:00', 19],
['2025-10-16 07:45:00', 19],
['2025-10-16 08:00:00', 39],
['2025-10-16 08:15:00', 59],
['2025-10-16 08:30:00', 69],
['2025-10-16 08:45:00', 79],
['2025-10-16 09:00:00', 109],
['2025-10-16 09:15:00', 129],
['2025-10-16 09:30:00', 139],
['2025-10-16 09:45:00', 149],
['2025-10-16 10:00:00', 169],
['2025-10-16 10:15:00', 169],
['2025-10-16 10:30:00', 139],
['2025-10-16 10:45:00', 129],
['2025-10-16 11:00:00', 149],
['2025-10-16 11:15:00', 89],
['2025-10-16 11:30:00', 79],
['2025-10-16 11:45:00', 99],
['2025-10-16 12:00:00', 69],
['2025-10-16 12:15:00', 69],
['2025-10-16 12:30:00', 69],
['2025-10-16 12:45:00', 69]
]
}
]
}
})
const tableStore: any = new TableStore({
url: '/user-boot/dept/deptTree',
method: 'POST',
showPage: false,
column: [],
beforeSearchFun: () => {
tableStore.table.params.searchBeginTime = prop.timeValue?.[0] || getTimeOfTheMonth(prop.timeKey)[0]
tableStore.table.params.searchEndTime = prop.timeValue?.[1] || getTimeOfTheMonth(prop.timeKey)[1]
},
loadCallback: () => {
tableStore.table.data = []
}
})
const tableRef = ref()
provide('tableRef', tableRef)
provide('tableStore', tableStore)
onMounted(() => {
tableStore.index()
})
watch(
() => prop.timeKey,
val => {
tableStore.index()
}
)
watch(
() => prop.timeValue, // 监听的目标(函数形式避免直接传递 props 导致的警告)
(newVal, oldVal) => {
tableStore.index()
},
{
deep: true // 若 timeValue 是对象/数组,需开启深度监听
}
)
const addMenu = () => {}
</script>
<style lang="scss" scoped></style>

View File

@@ -0,0 +1,218 @@
<template>
<div>
<!--暂态事件统计 -->
<my-echart
class="tall"
:options="echartList"
:style="{ width: prop.width, height: `calc(${prop.height} / 2 )` }"
/>
<Table ref="tableRef" @cell-click="cellClickEvent" :height="`calc(${prop.height} / 2 )`" isGroup></Table>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, provide, reactive, watch, h } from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import MyEchart from '@/components/echarts/MyEchart.vue'
import { useDictData } from '@/stores/dictData'
import { ElMessage, ElMessageBox } from 'element-plus'
import { getTimeOfTheMonth } from '@/utils/formatTime'
import { useConfig } from '@/stores/config'
const config = useConfig()
const prop = defineProps({
width: { type: String },
height: { type: String },
timeKey: { type: String },
timeValue: { type: Object }
})
const data = [
{
name: '电压中断',
value: 4
},
{
name: '电压暂降',
value: 41
},
{
name: '电压暂升',
value: 46
}
]
const echartList = ref({
title: {},
tooltip: {
trigger: 'item'
},
legend: {
orient: 'vertical',
top: 'center',
right: '5%',
formatter: function (e: any) {
return e + ' ' + data.filter(item => item.name == e)[0].value + '次'
}
},
xAxis: {
show: false
},
yAxis: {
show: false
},
grid: {
left: '10px',
right: '20px'
},
color: ['#FF9100', '#FFBF00', config.layout.elementUiPrimary[0]],
options: {
dataZoom: null,
title: [
{
text: '暂态事件统计',
left: 'center'
},
{
text: data[0].value + data[1].value + data[2].value + '次',
left: 'center',
top: 'center'
}
],
series: [
{
type: 'pie',
center: 'center',
radius: ['50%', '70%'],
label: {
show: false,
position: 'outside',
textStyle: {
//数值样式
}
},
name: '事件统计',
data: data
}
]
}
})
const OverLimitDetailsRef = ref()
const tableStore: any = new TableStore({
url: '/user-boot/dept/deptTree',
method: 'POST',
showPage: false,
column: [
{
field: 'index',
title: '序号',
width: '60',
formatter: (row: any) => {
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
}
},
{
title: '名称',
field: 'name',
minWidth: '90'
},
{
title: '电压中断(次)',
field: 'type',
minWidth: '70',
render: 'customTemplate',
customTemplate: (row: any) => {
return `<span style='cursor: pointer;text-decoration: underline;'>${row.type}</span>`
}
},
{
title: '电压暂降(次)',
field: 'type1',
minWidth: '80',
render: 'customTemplate',
customTemplate: (row: any) => {
return `<span style='cursor: pointer;text-decoration: underline;'>${row.type1}</span>`
}
},
{
title: '电压暂升(次)',
field: 'type2',
minWidth: '80',
render: 'customTemplate',
customTemplate: (row: any) => {
return `<span style='cursor: pointer;text-decoration: underline;'>${row.type2}</span>`
}
}
],
beforeSearchFun: () => {
tableStore.table.params.searchBeginTime = prop.timeValue?.[0] || getTimeOfTheMonth(prop.timeKey)[0]
tableStore.table.params.searchEndTime = prop.timeValue?.[1] || getTimeOfTheMonth(prop.timeKey)[1]
},
loadCallback: () => {
tableStore.table.data = [
{
name: '35kV1进线',
type: '2',
type1: '38',
type2: '35'
},
{
name: '35kV1变压器',
type: '2',
type1: '1',
type2: '3'
},
{
name: '35kV1母线',
type: '0',
type1: '1',
type2: '4'
},
{
name: '35kV2母线',
type: '0',
type1: '1',
type2: '4'
}
]
}
})
const tableRef = ref()
provide('tableRef', tableRef)
provide('tableStore', tableStore)
// 点击行
const cellClickEvent = ({ row, column }: any) => {
if (column.field != 'name') {
console.log(row)
OverLimitDetailsRef.value.open(row)
}
}
onMounted(() => {
setTimeout(() => {
tableStore.index()
}, 200)
})
watch(
() => prop.timeKey,
val => {
tableStore.index()
}
)
watch(
() => prop.timeValue, // 监听的目标(函数形式避免直接传递 props 导致的警告)
(newVal, oldVal) => {
tableStore.index()
},
{
deep: true // 若 timeValue 是对象/数组,需开启深度监听
}
)
const addMenu = () => {}
</script>
<style lang="scss" scoped></style>

View File

@@ -0,0 +1,280 @@
<template>
<div>
<!--趋势对比 -->
<TableHeader :showReset="false" @selectChange="selectChange">
<template v-slot:select>
<el-form-item label="监测点名称">
<el-select
v-model="tableStore.table.params.power"
placeholder="请选择监测点名称"
clearable
style="width: 130px"
>
<el-option
v-for="item in powerList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="电能质量指标">
<el-select
v-model="tableStore.table.params.indicator"
placeholder="请选择电能质量指标"
clearable
style="width: 130px"
>
<el-option
v-for="item in indicatorList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="谐波次数">
<el-select
v-model="tableStore.table.params.exceedingTheLimit"
placeholder="请选择谐波次数"
clearable
style="width: 90px"
>
<el-option
v-for="item in exceedingTheLimitList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</template>
</TableHeader>
<my-echart
class="tall"
:options="echartList"
:style="{ width: prop.width, height: `calc(${prop.height} - ${headerHeight}px )` }"
/>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, provide, reactive, watch, h } from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import TableHeader from '@/components/table/header/index.vue'
import { useDictData } from '@/stores/dictData'
import { ElMessage, ElMessageBox } from 'element-plus'
import { getTimeOfTheMonth } from '@/utils/formatTime'
import MyEchart from '@/components/echarts/MyEchart.vue'
import { useConfig } from '@/stores/config'
const prop = defineProps({
width: { type: String },
height: { type: String },
timeKey: { type: String },
timeValue: { type: Object }
})
const config = useConfig()
const powerList: any = ref([
{
label: '1#变压器',
value: '1'
},
{
label: '2#变压器',
value: '2'
}
])
const exceedingTheLimitList: any = ref([
{
label: '2次',
value: '2'
},
{
label: '3次',
value: '3'
},
{
label: '4次',
value: '4'
},
{
label: '5次',
value: '5'
}
])
const indicatorList: any = ref([
{
label: '谐波电压总畸变率',
value: '1'
},
{
label: '各次谐波电压',
value: '2'
},
{
label: '各次谐波电压',
value: '3'
},
{
label: '三相电压不平衡',
value: '4'
}
])
const echartList = ref({
title: {
text: '趋势对比'
},
xAxis: {
type: 'time',
axisLabel: {
formatter: {
day: '{MM}-{dd}',
month: '{MM}',
year: '{yyyy}'
}
}
},
yAxis: {},
grid: {
left: '10px',
right: '20px'
},
options: {
series: [
{
// name: '暂降次数',
type: 'line',
name: '治理前',
showSymbol: false,
smooth: true,
data: [
['2025-10-16 07:00:00', 1],
['2025-10-16 07:15:00', 1],
['2025-10-16 07:30:00', 1],
['2025-10-16 07:45:00', 1],
['2025-10-16 08:00:00', 3],
['2025-10-16 08:15:00', 5],
['2025-10-16 08:30:00', 6],
['2025-10-16 08:45:00', 7],
['2025-10-16 09:00:00', 10],
['2025-10-16 09:15:00', 12],
['2025-10-16 09:30:00', 13],
['2025-10-16 09:45:00', 14],
['2025-10-16 10:00:00', 16],
['2025-10-16 10:15:00', 16],
['2025-10-16 10:30:00', 13],
['2025-10-16 10:45:00', 12],
['2025-10-16 11:00:00', 14],
['2025-10-16 11:15:00', 8],
['2025-10-16 11:30:00', 7],
['2025-10-16 11:45:00', 9],
['2025-10-16 12:00:00', 6],
['2025-10-16 12:15:00', 6],
['2025-10-16 12:30:00', 6],
['2025-10-16 12:45:00', 6]
],
itemStyle: {
normal: {
//这里是颜色
color: function (params: any) {
if (params.value[1] == 0 || params.value[1] == 3.14159) {
return '#ccc'
} else {
return config.layout.elementUiPrimary[0]
}
}
}
},
yAxisIndex: 0
},
{
name: '治理后',
type: 'line',
showSymbol: false,
smooth: true,
data: [
['2025-10-16 07:00:00', 10],
['2025-10-16 07:15:00', 10],
['2025-10-16 07:30:00', 10],
['2025-10-16 07:45:00', 10],
['2025-10-16 08:00:00', 30],
['2025-10-16 08:15:00', 50],
['2025-10-16 08:30:00', 60],
['2025-10-16 08:45:00', 70],
['2025-10-16 09:00:00', 100],
['2025-10-16 09:15:00', 120],
['2025-10-16 09:30:00', 130],
['2025-10-16 09:45:00', 140],
['2025-10-16 10:00:00', 160],
['2025-10-16 10:15:00', 160],
['2025-10-16 10:30:00', 130],
['2025-10-16 10:45:00', 120],
['2025-10-16 11:00:00', 140],
['2025-10-16 11:15:00', 80],
['2025-10-16 11:30:00', 70],
['2025-10-16 11:45:00', 90],
['2025-10-16 12:00:00', 60],
['2025-10-16 12:15:00', 60],
['2025-10-16 12:30:00', 60],
['2025-10-16 12:45:00', 60]
]
}
]
}
})
const headerHeight = ref(57)
const selectChange = (showSelect: any, height: any) => {
headerHeight.value = height
}
const tableStore: any = new TableStore({
url: '/user-boot/role/selectRoleDetail?id=0',
method: 'POST',
showPage: false,
exportName: '主要监测点列表',
column: [],
beforeSearchFun: () => {
tableStore.table.params.searchBeginTime = prop.timeValue?.[0] || getTimeOfTheMonth(prop.timeKey)[0]
tableStore.table.params.searchEndTime = prop.timeValue?.[1] || getTimeOfTheMonth(prop.timeKey)[1]
},
loadCallback: () => {
tableStore.table.height = `calc(${prop.height} - 80px)`
}
})
const tableRef = ref()
provide('tableRef', tableRef)
tableStore.table.params.power = '1'
tableStore.table.params.indicator = '1'
tableStore.table.params.exceedingTheLimit = '1'
tableStore.table.params.searchValue = ''
provide('tableStore', tableStore)
onMounted(() => {
tableStore.index()
})
watch(
() => prop.timeKey,
val => {
tableStore.index()
}
)
watch(
() => prop.timeValue, // 监听的目标(函数形式避免直接传递 props 导致的警告)
(newVal, oldVal) => {
tableStore.index()
},
{
deep: true // 若 timeValue 是对象/数组,需开启深度监听
}
)
const addMenu = () => {}
</script>
<style lang="scss" scoped>
:deep(.el-select) {
min-width: 80px;
}
</style>

View File

@@ -1,288 +1,288 @@
<template> <template>
<div class="chart"> <div class="chart">
<div ref="chartRef" class="my-chart" /> <div ref="chartRef" class="my-chart" />
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onBeforeUnmount, onMounted, ref, defineExpose, watch, nextTick } from 'vue' import { onBeforeUnmount, onMounted, ref, defineExpose, watch, nextTick } from 'vue'
// import echarts from './echarts' // import echarts from './echarts'
import * as echarts from 'echarts' // 全引入 import * as echarts from 'echarts' // 全引入
import 'echarts-gl' import 'echarts-gl'
import 'echarts-liquidfill' import 'echarts-liquidfill'
import 'echarts/lib/component/dataZoom' import 'echarts/lib/component/dataZoom'
import { color, gradeColor3 } from './color' import { color, gradeColor3 } from './color'
import { useConfig } from '@/stores/config' import { useConfig } from '@/stores/config'
// import { nextTick } from 'process' // import { nextTick } from 'process'
const config = useConfig() const config = useConfig()
color[0] = config.layout.elementUiPrimary[0] color[0] = config.layout.elementUiPrimary[0]
const chartRef = ref<HTMLDivElement>() const chartRef = ref<HTMLDivElement>()
const props = defineProps(['options', 'isInterVal', 'pieInterVal']) const props = defineProps(['options', 'isInterVal', 'pieInterVal'])
let chart: echarts.ECharts | any = null let chart: echarts.ECharts | any = null
const resizeHandler = () => { const resizeHandler = () => {
// 不在视野中的时候不进行resize // 不在视野中的时候不进行resize
if (!chartRef.value) return if (!chartRef.value) return
if (chartRef.value.offsetHeight == 0) return if (chartRef.value.offsetHeight == 0) return
chart.getZr().painter.getViewportRoot().style.display = 'none' chart.getZr().painter.getViewportRoot().style.display = 'none'
requestAnimationFrame(() => { requestAnimationFrame(() => {
chart.resize() chart.resize()
chart.getZr().painter.getViewportRoot().style.display = '' chart.getZr().painter.getViewportRoot().style.display = ''
}) })
} }
const initChart = () => { const initChart = () => {
if (!props.isInterVal && !props.pieInterVal) { if (!props.isInterVal && !props.pieInterVal) {
chart?.dispose() chart?.dispose()
} }
// chart?.dispose() // chart?.dispose()
chart = echarts.init(chartRef.value as HTMLDivElement) chart = echarts.init(chartRef.value as HTMLDivElement)
const options = { const options = {
title: { title: {
left: 'center', left: 'center',
// textStyle: { // textStyle: {
color: '#000', color: '#000',
textStyle: { textStyle: {
color: '#000', color: '#000',
fontSize: '18' fontSize: '18'
}, },
// }, // },
...(props.options?.title || null) ...(props.options?.title || null)
}, },
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
textStyle: { textStyle: {
color: '#fff', color: '#fff',
fontStyle: 'normal', fontStyle: 'normal',
opacity: 0.35, opacity: 0.35,
fontSize: 14 fontSize: 14
}, },
backgroundColor: 'rgba(0,0,0,0.55)', backgroundColor: 'rgba(0,0,0,0.55)',
borderWidth: 0, borderWidth: 0,
// confine: true, // confine: true,
...(props.options?.tooltip || null) ...(props.options?.tooltip || null)
}, },
toolbox: { toolbox: {
right: 10, right: 20,
top: 0, top: 15,
feature: { feature: {
saveAsImage: { saveAsImage: {
title: '保存图片' title: '保存图片'
}, },
...(props.options?.toolbox?.featureProps || null) ...(props.options?.toolbox?.featureProps || null)
}, },
// }, // },
...(props.options?.toolbox || null) ...(props.options?.toolbox || null)
}, },
legend: { legend: {
right: 40, right: 50,
top: 10, top: 25,
itemGap: 10, itemGap: 10,
itemStyle: {}, itemStyle: {},
// textStyle: { // textStyle: {
fontSize: 12, fontSize: 12,
// padding: [2, 0, 0, 0], //[上、右、下、左] // padding: [2, 0, 0, 0], //[上、右、下、左]
// }, // },
itemWidth: 15, itemWidth: 15,
itemHeight: 10, itemHeight: 10,
...(props.options?.legend || null) ...(props.options?.legend || null)
}, },
grid: { grid: {
top: '60px', top: '50px',
left: '30px', left: '30px',
right: '70px', right: '70px',
bottom: props.options?.options?.dataZoom === null ? '10px' : '40px', bottom: props.options?.options?.dataZoom === null ? '10px' : '40px',
containLabel: true, containLabel: true,
...(props.options?.grid || null) ...(props.options?.grid || null)
}, },
xAxis: props.options?.xAxis ? handlerXAxis() : null, xAxis: props.options?.xAxis ? handlerXAxis() : null,
yAxis: props.options?.yAxis ? handlerYAxis() : null, yAxis: props.options?.yAxis ? handlerYAxis() : null,
dataZoom: props.options?.dataZoom || [ dataZoom: props.options?.dataZoom || [
{ {
type: 'inside', type: 'inside',
height: 13, height: 13,
start: 0, start: 0,
bottom: '20px', bottom: '20px',
end: 100 end: 100
}, },
{ {
start: 0, start: 0,
height: 13, height: 13,
bottom: '20px', bottom: '20px',
end: 100 end: 100
} }
// { // {
// show: true, // show: true,
// yAxisIndex: 0, // yAxisIndex: 0,
// width: 12, // width: 12,
// handleSize: 8, // handleSize: 8,
// showDataShadow: false, // showDataShadow: false,
// right: 12 // right: 12
// } // }
], ],
color: props.options?.color || color, color: props.options?.color || color,
series: props.options?.series, series: props.options?.series,
...props.options?.options ...props.options?.options
} }
// console.log(options.series,"获取x轴"); // console.log(options.series,"获取x轴");
handlerBar(options) handlerBar(options)
// 处理柱状图 // 处理柱状图
chart.setOption(options, true) chart.setOption(options, true)
chart.group = 'group' chart.group = 'group'
setTimeout(() => { setTimeout(() => {
chart.resize() chart.resize()
}, 0) }, 0)
} }
const handlerBar = (options: any) => { const handlerBar = (options: any) => {
if (Array.isArray(options.series)) { if (Array.isArray(options.series)) {
options.series.forEach((item: any) => { options.series.forEach((item: any) => {
if (item.type === 'bar') { if (item.type === 'bar') {
item.barMinHeight = 10 item.barMinHeight = 5
item.barMaxWidth = 20 item.barMaxWidth = 20
item.itemStyle = Object.assign( item.itemStyle = Object.assign(
{ {
color: (params: any) => { color: (params: any) => {
if (params.value == 0 || params.value == 3.14159) { if (params.value == 0 || params.value == 3.14159) {
return '#ccc' return '#ccc'
} else { } else {
return props.options?.color return props.options?.color
? props.options?.color[params.seriesIndex] ? props.options?.color[params.seriesIndex]
: color[params.seriesIndex] : color[params.seriesIndex]
} }
} }
}, },
item.itemStyle item.itemStyle
) )
} }
}) })
} }
} }
const handlerYAxis = () => { const handlerYAxis = () => {
let temp = { let temp = {
type: 'value', type: 'value',
nameGap: 15, nameGap: 15,
nameTextStyle: { nameTextStyle: {
color: '#000' color: '#000'
}, },
splitNumber: 5, splitNumber: 5,
minInterval: 1, minInterval: 1,
axisLine: { axisLine: {
show: true, show: true,
lineStyle: { lineStyle: {
color: '#000' color: '#000'
} }
}, },
axisLabel: { axisLabel: {
color: '#000', color: '#000',
fontSize: 14, fontSize: 14,
formatter: function (value) { formatter: function (value) {
return parseFloat(value.toFixed(1)) // 格式化显示为一位小数 return parseFloat(value.toFixed(1)) // 格式化显示为一位小数
} }
}, },
splitLine: { splitLine: {
lineStyle: { lineStyle: {
// 使用深浅的间隔色 // 使用深浅的间隔色
color: ['#ccc'], color: ['#ccc'],
type: 'dashed', type: 'dashed',
opacity: 0.5 opacity: 0.5
} }
} }
} }
// props.options?.xAxis 是数组还是对象 // props.options?.xAxis 是数组还是对象
if (Array.isArray(props.options?.yAxis)) { if (Array.isArray(props.options?.yAxis)) {
return props.options?.yAxis.map((item: any) => { return props.options?.yAxis.map((item: any) => {
return { return {
...temp, ...temp,
...item ...item
} }
}) })
} else { } else {
return { return {
...temp, ...temp,
...props.options?.yAxis ...props.options?.yAxis
} }
} }
} }
const handlerXAxis = () => { const handlerXAxis = () => {
let temp = { let temp = {
type: 'category', type: 'category',
axisTick: { show: false }, axisTick: { show: false },
axisLine: { axisLine: {
// lineStyle: { // lineStyle: {
color: '#000' color: '#000'
// } // }
}, },
axisLabel: { axisLabel: {
// textStyle: { // textStyle: {
fontFamily: 'dinproRegular', fontFamily: 'dinproRegular',
color: '#000', color: '#000',
fontSize: '12' fontSize: '12'
// } // }
} }
// boundaryGap: false, // boundaryGap: false,
} }
// props.options?.xAxis 是数组还是对象 // props.options?.xAxis 是数组还是对象
if (Array.isArray(props.options?.xAxis)) { if (Array.isArray(props.options?.xAxis)) {
return props.options?.xAxis.map((item: any) => { return props.options?.xAxis.map((item: any) => {
return { return {
...temp, ...temp,
...item ...item
} }
}) })
} else { } else {
return { return {
...temp, ...temp,
...props.options?.xAxis ...props.options?.xAxis
} }
} }
} }
let throttle: ReturnType<typeof setTimeout> let throttle: ReturnType<typeof setTimeout>
// 动态计算table高度 // 动态计算table高度
const resizeObserver = new ResizeObserver(entries => { const resizeObserver = new ResizeObserver(entries => {
for (const entry of entries) { for (const entry of entries) {
if (throttle) { if (throttle) {
clearTimeout(throttle) clearTimeout(throttle)
} }
throttle = setTimeout(() => { throttle = setTimeout(() => {
resizeHandler() resizeHandler()
}, 100) }, 100)
} }
}) })
onMounted(() => { onMounted(() => {
initChart() initChart()
resizeObserver.observe(chartRef.value!) resizeObserver.observe(chartRef.value!)
}) })
defineExpose({ initChart }) defineExpose({ initChart })
onBeforeUnmount(() => { onBeforeUnmount(() => {
resizeObserver.unobserve(chartRef.value!) resizeObserver.unobserve(chartRef.value!)
chart?.dispose() chart?.dispose()
}) })
watch( watch(
() => props.options, () => props.options,
(newVal, oldVal) => { (newVal, oldVal) => {
initChart() initChart()
} }
) )
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.chart { .chart {
width: 100%; width: 100%;
height: 100%; height: 100%;
position: relative; position: relative;
.el-button { .el-button {
position: absolute; position: absolute;
right: 0px; right: 0px;
top: -60px; top: -60px;
} }
.my-chart { .my-chart {
height: 100%; height: 100%;
width: 100%; width: 100%;
} }
} }
</style> </style>

View File

@@ -1,4 +1,4 @@
export let color = [ '#07CCCA','#00BFF5', '#FFBF00', '#77DA63', '#D5FF6B', '#Ff6600', '#FF9100', '#5B6E96', '#66FFCC', '#B3B3B3'] export let color = [ '#07CCCA','#00BFF5', '#FFBF00', '#77DA63', '#Ff6600', '#FF9100', '#5B6E96', '#66FFCC', '#B3B3B3']
export const gradeColor3 = ['#339966', '#FFCC33', '#A52a2a'] export const gradeColor3 = ['#339966', '#FFCC33', '#A52a2a']
export const gradeColor5 = ['#00CC00', '#99CC99', '#FF9900','#996600','#A52a2a'] export const gradeColor5 = ['#00CC00', '#99CC99', '#FF9900','#996600','#A52a2a']

View File

@@ -1,3 +1,9 @@
<template>
<div>
</div>
</template>
<script lang="ts"> <script lang="ts">
import { createVNode, resolveComponent, defineComponent, computed, type CSSProperties } from 'vue' import { createVNode, resolveComponent, defineComponent, computed, type CSSProperties } from 'vue'
import svg from '@/components/icon/svg/index.vue' import svg from '@/components/icon/svg/index.vue'
@@ -27,7 +33,7 @@ export default defineComponent({
color: color color: color
} }
}) })
if(props.name){ if (props.name) {
if (props.name.indexOf('el-icon-') === 0) { if (props.name.indexOf('el-icon-') === 0) {
return () => return () =>
createVNode('el-icon', { class: 'icon el-icon', style: iconStyle.value }, [ createVNode('el-icon', { class: 'icon el-icon', style: iconStyle.value }, [

View File

@@ -1,295 +1,303 @@
<template> <template>
<!-- Icon --> <!-- Icon -->
<Icon class="ba-icon-dark" v-if="field.render == 'icon'" :name="fieldValue ? fieldValue : field.default ?? ''" /> <Icon class="ba-icon-dark" v-if="field.render == 'icon'" :name="fieldValue ? fieldValue : field.default ?? ''" />
<!-- switch --> <!-- switch -->
<div v-if="field.render == 'switch' && fieldValue != undefined"> <div v-if="field.render == 'switch' && fieldValue != undefined">
<el-switch <el-switch
@change="onChangeField(field, $event)" @change="onChangeField(field, $event)"
:model-value="fieldValue.toString()" :model-value="fieldValue.toString()"
:loading="row.loading" :loading="row.loading"
inline-prompt inline-prompt
:active-value="field.activeValue" :active-value="field.activeValue"
:active-text="field.activeText" :active-text="field.activeText"
:inactive-value="field.inactiveValue" :inactive-value="field.inactiveValue"
:inactive-text="field.inactiveText" :inactive-text="field.inactiveText"
/> />
</div> </div>
<!-- image --> <!-- image -->
<div v-if="field.render == 'image' && fieldValue" class="ba-render-image"> <div v-if="field.render == 'image' && fieldValue" class="ba-render-image">
<el-image <el-image
:hide-on-click-modal="true" :hide-on-click-modal="true"
:preview-teleported="true" :preview-teleported="true"
:preview-src-list="[fullUrl(fieldValue)]" :preview-src-list="[fieldValue]"
:src="fieldValue.length > 100 ? fieldValue : fullUrl(fieldValue)" :src="fieldValue.length > 100 ? fieldValue : getUrl(fieldValue)"
></el-image> ></el-image>
</div> </div>
<!-- tag --> <!-- tag -->
<div v-if="field.render == 'tag' && fieldValue !== ''"> <div v-if="field.render == 'tag' && fieldValue !== ''">
<el-tag :type="getTagType(fieldValue, field.custom)" size="small"> <el-tag :type="getTagType(fieldValue, field.custom)" size="small">
{{ field.replaceValue ? field.replaceValue[fieldValue] : fieldValue }} {{ field.replaceValue ? field.replaceValue[fieldValue] : fieldValue }}
</el-tag> </el-tag>
</div> </div>
<!-- datetime --> <!-- datetime -->
<div v-if="field.render == 'datetime'"> <div v-if="field.render == 'datetime'">
{{ !fieldValue ? '/' : timeFormat(fieldValue, field.timeFormat ?? undefined) }} {{ !fieldValue ? '/' : timeFormat(fieldValue, field.timeFormat ?? undefined) }}
</div> </div>
<!-- color --> <!-- color -->
<div v-if="field.render == 'color'"> <div v-if="field.render == 'color'">
<div :style="{ background: fieldValue }" class="ba-render-color"></div> <div :style="{ background: fieldValue }" class="ba-render-color"></div>
</div> </div>
<!-- customTemplate 自定义模板 --> <!-- customTemplate 自定义模板 -->
<div <div
v-if="field.render == 'customTemplate'" v-if="field.render == 'customTemplate'"
v-html="field.customTemplate ? field.customTemplate(row, field, fieldValue, column, index) : ''" v-html="field.customTemplate ? field.customTemplate(row, field, fieldValue, column, index) : ''"
></div> ></div>
<!-- 自定义组件/函数渲染 --> <!-- 自定义组件/函数渲染 -->
<component <component
v-if="field.render == 'customRender'" v-if="field.render == 'customRender'"
:is="field.customRender" :is="field.customRender"
:renderRow="row" :renderRow="row"
:renderField="field" :renderField="field"
:renderValue="fieldValue" :renderValue="fieldValue"
:renderColumn="column" :renderColumn="column"
:renderIndex="index" :renderIndex="index"
/> />
<!-- 按钮组 --> <!-- 按钮组 -->
<div v-if="field.render == 'buttons' && buttons" class="cn-render-buttons"> <div v-if="field.render == 'buttons' && buttons" class="cn-render-buttons">
<template v-for="(btn, idx) in buttons" :key="idx"> <template v-for="(btn, idx) in buttons" :key="idx">
<!-- 常规按钮 --> <!-- 常规按钮 -->
<el-button <el-button
link link
v-if="btn.render == 'basicButton'" v-if="btn.render == 'basicButton'"
@click="onButtonClick(btn)" @click="onButtonClick(btn)"
:class="btn.class" :class="btn.class"
class="table-operate" class="table-operate"
:type="btn.type" :type="btn.type"
:loading="props.row[btn.loading] || props.row.loading || false" :loading="props.row[btn.loading] || props.row.loading || false"
v-bind="btn.attr" v-bind="btn.attr"
> >
<div v-if="btn.text || btn.title" class="table-operate-text">{{ btn.text || btn.title }}</div> <div v-if="btn.text || btn.title" class="table-operate-text">{{ btn.text || btn.title }}</div>
</el-button> </el-button>
<!-- 带提示信息的按钮 --> <!-- 带提示信息的按钮 -->
<el-tooltip <el-tooltip
v-if="btn.render == 'tipButton'" v-if="btn.render == 'tipButton'"
:disabled="btn.title && !btn.disabledTip ? false : true" :disabled="btn.title && !btn.disabledTip ? false : true"
:content="btn.title" :content="btn.title"
placement="top" placement="top"
> >
<el-button <el-button
link link
@click="onButtonClick(btn)" @click="onButtonClick(btn)"
:class="btn.class" :class="btn.class"
class="table-operate" class="table-operate"
:type="btn.type" :type="btn.type"
v-bind="btn.attr" v-bind="btn.attr"
> >
<div v-if="btn.text || btn.title" class="table-operate-text"> <div v-if="btn.text || btn.title" class="table-operate-text">
{{ btn.text || btn.title }} {{ btn.text || btn.title }}
</div> </div>
</el-button> </el-button>
</el-tooltip> </el-tooltip>
<!-- 带确认框的按钮 --> <!-- 带确认框的按钮 -->
<el-popconfirm <el-popconfirm
v-if="btn.render == 'confirmButton'" v-if="btn.render == 'confirmButton'"
:disabled="btn.disabled && btn.disabled(row, field)" :disabled="btn.disabled && btn.disabled(row, field)"
v-bind="btn.popconfirm" v-bind="btn.popconfirm"
@confirm="onButtonClick(btn)" @confirm="onButtonClick(btn)"
> >
<template #reference> <template #reference>
<div style="display: inline-block"> <div style="display: inline-block">
<el-button link :class="btn.class" class="table-operate" :type="btn.type" v-bind="btn.attr"> <el-button link :class="btn.class" class="table-operate" :type="btn.type" v-bind="btn.attr">
<div v-if="btn.text || btn.title" class="table-operate-text"> <div v-if="btn.text || btn.title" class="table-operate-text">
{{ btn.text || btn.title }} {{ btn.text || btn.title }}
</div> </div>
</el-button> </el-button>
</div> </div>
</template> </template>
</el-popconfirm> </el-popconfirm>
<el-dropdown v-if="btn.render == 'dropdown'" trigger="click" @command="handlerCommand"> <el-dropdown v-if="btn.render == 'dropdown'" trigger="click" @command="handlerCommand">
<el-button link type="primary" class="table-operate"> <el-button link type="primary" class="table-operate">
<div class="table-operate-text">更多</div> <div class="table-operate-text">更多</div>
</el-button> </el-button>
<template #dropdown> <template #dropdown>
<el-dropdown-menu> <el-dropdown-menu>
<el-dropdown-item <el-dropdown-item
v-for="item in btn.buttons" v-for="item in btn.buttons"
:key="item.text" :key="item.text"
:command="item" :command="item"
:style="{ :style="{
color: item.type === 'primary' ? 'var(--el-color-primary)' : 'var(--el-color-danger' color: item.type === 'primary' ? 'var(--el-color-primary)' : 'var(--el-color-danger'
}" }"
> >
{{ item.text }} {{ item.text }}
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</template> </template>
</el-dropdown> </el-dropdown>
</template> </template>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, inject } from 'vue' import { ref, inject } from 'vue'
import { ElMessageBox, type TagProps } from 'element-plus' import { ElMessageBox, type TagProps } from 'element-plus'
import type TableStoreClass from '@/utils/tableStore' import type TableStoreClass from '@/utils/tableStore'
import { fullUrl, timeFormat } from '@/utils/common' import { fullUrl, timeFormat } from '@/utils/common'
import type { VxeColumnProps } from 'vxe-table' import type { VxeColumnProps } from 'vxe-table'
import { getFileUrl } from '@/api/system-boot/file'
const TableStore = inject('tableStore') as TableStoreClass const TableStore = inject('tableStore') as TableStoreClass
interface Props { interface Props {
row: TableRow row: TableRow
field: TableColumn field: TableColumn
column: VxeColumnProps column: VxeColumnProps
index: number index: number
} }
const props = defineProps<Props>() const props = defineProps<Props>()
// 字段值(单元格值) // 字段值(单元格值)
const fieldName = ref(props.field.field) const fieldName = ref(props.field.field)
const fieldValue = ref(fieldName.value ? props.row[fieldName.value] : '') const fieldValue = ref(fieldName.value ? props.row[fieldName.value] : '')
if (fieldName.value && fieldName.value.indexOf('.') > -1) { if (fieldName.value && fieldName.value.indexOf('.') > -1) {
let fieldNameArr = fieldName.value.split('.') let fieldNameArr = fieldName.value.split('.')
let val: any = ref(props.row[fieldNameArr[0]]) let val: any = ref(props.row[fieldNameArr[0]])
for (let index = 1; index < fieldNameArr.length; index++) { for (let index = 1; index < fieldNameArr.length; index++) {
val.value = val.value ? val.value[fieldNameArr[index]] ?? '' : '' val.value = val.value ? val.value[fieldNameArr[index]] ?? '' : ''
} }
fieldValue.value = val.value fieldValue.value = val.value
} }
if (props.field.renderFormatter && typeof props.field.renderFormatter == 'function') { if (props.field.renderFormatter && typeof props.field.renderFormatter == 'function') {
fieldValue.value = props.field.renderFormatter(props.row, props.field, fieldValue.value, props.column, props.index) fieldValue.value = props.field.renderFormatter(props.row, props.field, fieldValue.value, props.column, props.index)
} }
const onChangeField = (row: any, value: any) => { const onChangeField = (row: any, value: any) => {
row.onChangeField && row.onChangeField(props.row, value) row.onChangeField && row.onChangeField(props.row, value)
// TableStore.onTableAction('field-change', { value: value, ...props }) // TableStore.onTableAction('field-change', { value: value, ...props })
} }
const onButtonClick = (btn: OptButton) => { const onButtonClick = (btn: OptButton) => {
btn.click && btn.click(props.row, props.field) btn.click && btn.click(props.row, props.field)
} }
const getTagType = (value: string, custom: any): TagProps['type'] => { const getTagType = (value: string, custom: any): TagProps['type'] => {
return custom && custom[value] ? custom[value] : '' return custom && custom[value] ? custom[value] : ''
} }
// 按钮组处理 最多显示三个按钮 多余的显示为下拉 // 按钮组处理 最多显示三个按钮 多余的显示为下拉
const buttonsFilter = props.field.buttons?.filter(btn => !(btn.disabled && btn.disabled(props.row, props.field))) || [] const buttonsFilter = props.field.buttons?.filter(btn => !(btn.disabled && btn.disabled(props.row, props.field))) || []
const buttons = ref<any[]>([]) const buttons = ref<any[]>([])
if (buttonsFilter.length > 3) { if (buttonsFilter.length > 3) {
buttonsFilter?.forEach((btn, index) => { buttonsFilter?.forEach((btn, index) => {
btn.text = btn.text || btn.title btn.text = btn.text || btn.title
if (index < 2) { if (index < 2) {
buttons.value.push(btn) buttons.value.push(btn)
} else { } else {
if (buttons.value.length > 2) { if (buttons.value.length > 2) {
buttons.value[buttons.value.length - 1].buttons.push(btn) buttons.value[buttons.value.length - 1].buttons.push(btn)
} else { } else {
buttons.value.push({ buttons.value.push({
render: 'dropdown', render: 'dropdown',
buttons: [btn] buttons: [btn]
}) })
} }
} }
}) })
} else { } else {
buttons.value = buttonsFilter buttons.value = buttonsFilter
} }
const handlerCommand = (item: OptButton) => { const handlerCommand = (item: OptButton) => {
switch (item.render) { switch (item.render) {
case 'basicButton': case 'basicButton':
onButtonClick(item) onButtonClick(item)
break break
case 'confirmButton': case 'confirmButton':
ElMessageBox.confirm(item.popconfirm?.title || '提示', { ElMessageBox.confirm(item.popconfirm?.title || '提示', {
confirmButtonText: item.popconfirm?.confirmButtonText || '确认', confirmButtonText: item.popconfirm?.confirmButtonText || '确认',
cancelButtonText: item.popconfirm?.cancelButtonText || '取消', cancelButtonText: item.popconfirm?.cancelButtonText || '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
onButtonClick(item) onButtonClick(item)
}) })
default: default:
break break
} }
} }
</script> const getUrl = (url: string) => {
getFileUrl({ filePath: url }).then(res => {
<style scoped lang="scss"> return res.data
.m-10 { })
margin: 4px; }
} </script>
.ba-render-image { <style scoped lang="scss">
text-align: center; .m-10 {
} margin: 4px;
}
.images-item {
width: 50px; .ba-render-image {
margin: 0 5px; text-align: center;
} }
.el-image { .images-item {
height: 36px; width: 50px;
// width: 36px; margin: 0 5px;
} }
.table-operate-text { .el-image {
padding-left: 5px; height: 36px;
font-size: 12px; // width: 36px;
} }
.table-operate { .table-operate-text {
padding: 4px 5px; padding-left: 5px;
height: auto; font-size: 12px;
} }
.cn-render-buttons { .table-operate {
display: flex; padding: 4px 5px;
align-items: center; height: auto;
justify-content: center; }
.icon { .cn-render-buttons {
font-size: 12px !important; display: flex;
// color: var(--ba-bg-color-overlay) !important; align-items: center;
} justify-content: center;
}
.icon {
.move-button { font-size: 12px !important;
cursor: move; // color: var(--ba-bg-color-overlay) !important;
} }
}
.ml-6 {
display: inline-flex; .move-button {
vertical-align: middle; cursor: move;
margin-left: 6px; }
}
.ml-6 {
.ml-6 + .el-button { display: inline-flex;
margin-left: 6px; vertical-align: middle;
} margin-left: 6px;
}
.ba-render-color {
height: 25px; .ml-6 + .el-button {
width: 100%; margin-left: 6px;
} }
.cn-render-buttons { .ba-render-color {
:deep(.el-button) { height: 25px;
margin-left: 0; width: 100%;
} }
}
</style> .cn-render-buttons {
:deep(.el-button) {
margin-left: 0;
}
}
.ba-render-image {
text-align: center;
}
</style>

View File

@@ -1,306 +1,321 @@
<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; height: 34px; margin-right: 20px; display: flex; flex-wrap: wrap" ref="headerForm" style="flex: 1; height: 34px; margin-right: 20px; display: flex; flex-wrap: wrap"
@submit.prevent="" @keyup.enter="onComSearch" label-position="left" :inline="true"> ref="headerForm"
<el-form-item label="日期" v-if="datePicker" style="grid-column: span 2; max-width: 570px"> @submit.prevent=""
<DatePicker ref="datePickerRef" :nextFlag="nextFlag" :theCurrentTime="theCurrentTime"></DatePicker> @keyup.enter="onComSearch"
</el-form-item> label-position="left"
:inline="true"
<el-form-item label="区域" v-if="area"> >
<Area ref="areaRef" v-model.trim="tableStore.table.params.deptIndex" /> <el-form-item label="日期" v-if="datePicker" style="grid-column: span 2; max-width: 570px">
</el-form-item> <DatePicker ref="datePickerRef" :nextFlag="nextFlag" :theCurrentTime="theCurrentTime"></DatePicker>
<slot name="select"></slot> </el-form-item>
</el-form>
<template v-if="$slots.select || datePicker || showSearch"> <el-form-item label="区域" v-if="area">
<el-button type="primary" @click="showSelectChange" v-if="showUnfoldButton"> <Area ref="areaRef" v-model.trim="tableStore.table.params.deptIndex" />
<Icon size="14" name="el-icon-ArrowUp" style="color: #fff" v-if="showSelect" /> </el-form-item>
<Icon size="14" name="el-icon-ArrowDown" style="color: #fff" v-else /> <slot name="select"></slot>
</el-button> </el-form>
<el-button @click="onComSearch" v-if="showSearch" type="primary" :icon="Search">查询</el-button> <template v-if="$slots.select || datePicker || showSearch">
<el-button @click="onResetForm" v-if="showSearch && showReset" :icon="RefreshLeft">重置</el-button> <el-button type="primary" @click="showSelectChange" v-if="showUnfoldButton">
<el-button @click="onExport" v-if="showExport" :loading="tableStore.table.loading" type="primary" <Icon size="14" name="el-icon-ArrowUp" style="color: #fff" v-if="showSelect" />
icon="el-icon-Download">导出</el-button> <Icon size="14" name="el-icon-ArrowDown" style="color: #fff" v-else />
</template> </el-button>
<slot name="operation"></slot> <el-button @click="onComSearch" v-if="showSearch" type="primary" :icon="Search">查询</el-button>
</div> <el-button @click="onResetForm" v-if="showSearch && showReset" :icon="RefreshLeft">重置</el-button>
<el-form :style="showSelect && showUnfoldButton ? headerFormSecondStyleOpen : headerFormSecondStyleClose" <el-button
ref="headerFormSecond" @submit.prevent="" @keyup.enter="onComSearch" label-position="left" @click="onExport"
:inline="true"></el-form> v-if="showExport"
</div> :loading="tableStore.table.loading"
</template> type="primary"
icon="el-icon-Download"
<script setup lang="ts"> >
import { inject, ref, onMounted, nextTick, onUnmounted } from 'vue' 导出
import type TableStore from '@/utils/tableStore' </el-button>
import DatePicker from '@/components/form/datePicker/index.vue' </template>
import Area from '@/components/form/area/index.vue' <slot name="operation"></slot>
import { mainHeight } from '@/utils/layout' </div>
import { useDictData } from '@/stores/dictData' <el-form
import { Search, RefreshLeft } from '@element-plus/icons-vue' :style="showSelect && showUnfoldButton ? headerFormSecondStyleOpen : headerFormSecondStyleClose"
import { defineProps } from 'vue' ref="headerFormSecond"
const emit = defineEmits(['selectChange',]) @submit.prevent=""
@keyup.enter="onComSearch"
const tableStore = inject('tableStore') as TableStore label-position="left"
const tableHeader = ref() :inline="true"
const datePickerRef = ref() ></el-form>
const dictData = useDictData() </div>
const areaRef = ref() </template>
const headerForm = ref()
const headerFormSecond = ref() <script setup lang="ts">
const num = ref(0) import { inject, ref, onMounted, nextTick, onUnmounted } from 'vue'
interface Props { import type TableStore from '@/utils/tableStore'
datePicker?: boolean import DatePicker from '@/components/form/datePicker/index.vue'
area?: boolean import Area from '@/components/form/area/index.vue'
showSearch?: boolean import { mainHeight } from '@/utils/layout'
nextFlag?: boolean //控制时间是否可以往后推 import { useDictData } from '@/stores/dictData'
theCurrentTime?: boolean //控制时间前3天展示上个月时间 import { Search, RefreshLeft } from '@element-plus/icons-vue'
showReset?: boolean //是否显示重置 import { defineProps } from 'vue'
showExport?: boolean //导出控制 const emit = defineEmits(['selectChange'])
}
const tableStore = inject('tableStore') as TableStore
const props = withDefaults(defineProps<Props>(), { const tableHeader = ref()
datePicker: false, const datePickerRef = ref()
area: false, const dictData = useDictData()
showSearch: true, const areaRef = ref()
nextFlag: false, const headerForm = ref()
theCurrentTime: true, const headerFormSecond = ref()
showReset: true, const num = ref(0)
showExport:false interface Props {
}) datePicker?: boolean
// 动态计算table高度 area?: boolean
let resizeObserver = new ResizeObserver(entries => { showSearch?: boolean
for (const entry of entries) { nextFlag?: boolean //控制时间是否可以往后推
handlerHeight() theCurrentTime?: boolean //控制时间前3天展示上个月时间
computedSearchRow() showReset?: boolean //是否显示重置
} showExport?: boolean //导出控制
}) }
const showUnfoldButton = ref(false)
const headerFormSecondStyleOpen = { const props = withDefaults(defineProps<Props>(), {
opacity: 1, datePicker: false,
height: 'auto', area: false,
padding: '0 15px 0px 15px' showSearch: true,
} nextFlag: false,
const headerFormSecondStyleClose = { theCurrentTime: true,
opacity: 0, showReset: true,
height: '0', showExport: false
padding: '0' })
} // 动态计算table高度
onMounted(() => { let resizeObserver = new ResizeObserver(entries => {
if (props.datePicker && tableStore) { for (const entry of entries) {
tableStore.table.params.searchBeginTime = datePickerRef.value?.timeValue[0] handlerHeight()
tableStore.table.params.searchEndTime = datePickerRef.value?.timeValue[1] computedSearchRow()
tableStore.table.params.startTime = datePickerRef.value?.timeValue[0] }
tableStore.table.params.endTime = datePickerRef.value?.timeValue[1] })
tableStore.table.params.timeFlag = datePickerRef.value?.timeFlag const showUnfoldButton = ref(false)
} const headerFormSecondStyleOpen = {
if (props.area) { opacity: 1,
tableStore.table.params.deptIndex = dictData.state.area[0].id height: 'auto',
} padding: '0 15px 0px 15px'
nextTick(() => { }
resizeObserver.observe(tableHeader.value) const headerFormSecondStyleClose = {
computedSearchRow() opacity: 0,
}) height: '0',
}) padding: '0'
onUnmounted(() => { }
resizeObserver.disconnect() onMounted(() => {
}) if (props.datePicker && tableStore) {
tableStore.table.params.searchBeginTime = datePickerRef.value?.timeValue[0]
const handlerHeight = () => { tableStore.table.params.searchEndTime = datePickerRef.value?.timeValue[1]
if (tableStore && tableStore.table) { tableStore.table.params.startTime = datePickerRef.value?.timeValue[0]
tableStore.table.height = mainHeight( tableStore.table.params.endTime = datePickerRef.value?.timeValue[1]
tableStore.table.publicHeight + tableHeader.value.offsetHeight + (tableStore.showPage ? 58 : 0) + 20 tableStore.table.params.timeFlag = datePickerRef.value?.timeFlag
).height as string }
} if (props.area) {
} tableStore.table.params.deptIndex = dictData.state.area[0].id
// 刷新页面handler高度出下拉 }
const computedSearchRow = () => { nextTick(() => {
resizeObserver.observe(tableHeader.value)
if (!headerForm.value.$el) return computedSearchRow()
})
})
// 清空headerFormSecond.value.$el下的元素 onUnmounted(() => {
while (headerFormSecond.value.$el.firstChild) { resizeObserver.disconnect()
headerForm.value.$el.appendChild(headerFormSecond.value.$el.firstChild) })
}
const handlerHeight = () => {
// 获取第一行放了几个表单 if (tableStore && tableStore.table) {
const elFormItem = headerForm.value.$el.querySelectorAll('.el-form-item') tableStore.table.height = mainHeight(
tableStore.table.publicHeight + tableHeader.value.offsetHeight + (tableStore.showPage ? 58 : 0) + 20
// 把第一行放不下的复制一份放到headerFormSecond.value.$el ).height as string
let width = 0 }
for (let i = 0; i < elFormItem.length; i++) { }
width += elFormItem[i].offsetWidth + 32 // 刷新页面handler高度出下拉
if (width > headerForm.value.$el.offsetWidth) { const computedSearchRow = () => {
headerFormSecond.value.$el.appendChild(elFormItem[i]) if (!headerForm.value.$el) return
}
// 清空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 // 获取第一行放了几个表单
} else { const elFormItem = headerForm.value.$el.querySelectorAll('.el-form-item')
showUnfoldButton.value = false
} // 把第一行放不下的复制一份放到headerFormSecond.value.$el
} let width = 0
for (let i = 0; i < elFormItem.length; i++) {
const showSelect = ref(false) width += elFormItem[i].offsetWidth + 32
const showSelectChange = () => { if (width > headerForm.value.$el.offsetWidth) {
showSelect.value = !showSelect.value headerFormSecond.value.$el.appendChild(elFormItem[i])
emit('selectChange', showSelect.value) }
} }
const onComSearch = async () => {
if (props.datePicker) { // 判断是否需要折叠
tableStore.table.params.searchBeginTime = datePickerRef.value.timeValue[0] if (headerFormSecond.value.$el.scrollHeight > 0) {
tableStore.table.params.searchEndTime = datePickerRef.value.timeValue[1] showUnfoldButton.value = true
tableStore.table.params.startTime = datePickerRef.value.timeValue[0] } else {
tableStore.table.params.endTime = datePickerRef.value.timeValue[1] showUnfoldButton.value = false
tableStore.table.params.timeFlag = datePickerRef.value.timeFlag }
} }
await tableStore.onTableAction('search', {}) const showSelect = ref(false)
} const showSelectChange = () => {
const setDatePicker = (list: any) => { showSelect.value = !showSelect.value
datePickerRef.value.setTimeOptions(list) setTimeout(() => {
} emit('selectChange', showSelect.value, tableHeader.value.offsetHeight)
const onResetForm = () => { }, 20)
//时间重置成默认值 }
datePickerRef.value?.setInterval(3) const onComSearch = async () => {
tableStore.onTableAction('reset', {}) if (props.datePicker) {
} tableStore.table.params.searchBeginTime = datePickerRef.value.timeValue[0]
const setInterval = (val: any) => { tableStore.table.params.searchEndTime = datePickerRef.value.timeValue[1]
datePickerRef.value.setInterval(val) tableStore.table.params.startTime = datePickerRef.value.timeValue[0]
} tableStore.table.params.endTime = datePickerRef.value.timeValue[1]
// 导出 tableStore.table.params.timeFlag = datePickerRef.value.timeFlag
const onExport = () => { }
tableStore.onTableAction('export', {showAllFlag:true})
} await tableStore.onTableAction('search', {})
}
defineExpose({ onComSearch, areaRef, setDatePicker, setInterval, datePickerRef, showSelectChange, computedSearchRow }) const setDatePicker = (list: any) => {
</script> datePickerRef.value.setTimeOptions(list)
}
<style scoped lang="scss"> const onResetForm = () => {
.cn-table-header { //时间重置成默认值
border: 1px solid var(--el-border-color); datePickerRef.value?.setInterval(3)
} tableStore.onTableAction('reset', {})
}
.table-header { const setInterval = (val: any) => {
position: relative; datePickerRef.value.setInterval(val)
overflow-x: auto; }
box-sizing: border-box; // 导出
display: flex; const onExport = () => {
align-items: center; tableStore.onTableAction('export', { showAllFlag: true })
width: 100%; }
max-width: 100%;
background-color: var(--ba-bg-color-overlay); defineExpose({ onComSearch, areaRef, setDatePicker, setInterval, datePickerRef, showSelectChange, computedSearchRow })
</script>
border-bottom: none;
padding: 13px 15px 9px; <style scoped lang="scss">
font-size: 14px; .cn-table-header {
border: 1px solid var(--el-border-color);
.table-header-operate-text { }
margin-left: 6px;
} .table-header {
} position: relative;
overflow-x: auto;
.table-com-search { box-sizing: border-box;
box-sizing: border-box; display: flex;
width: 100%; align-items: center;
max-width: 100%; width: 100%;
background-color: var(--ba-bg-color-overlay); max-width: 100%;
border: 1px solid var(--ba-border-color); background-color: var(--ba-bg-color-overlay);
border-bottom: none;
padding: 13px 15px 20px 15px; border-bottom: none;
font-size: 14px; padding: 13px 15px 9px;
} font-size: 14px;
#header-form-second, .table-header-operate-text {
#header-form { margin-left: 6px;
// display: flex; }
// flex-wrap: wrap; }
transition: all 0.3s;
} .table-com-search {
box-sizing: border-box;
.mlr-12 { width: 100%;
margin-left: 12px; max-width: 100%;
} background-color: var(--ba-bg-color-overlay);
border: 1px solid var(--ba-border-color);
.mlr-12+.el-button { border-bottom: none;
margin-left: 12px; padding: 13px 15px 20px 15px;
} font-size: 14px;
}
.table-search {
display: flex; #header-form-second,
margin-left: auto; #header-form {
// display: flex;
.quick-search { // flex-wrap: wrap;
width: auto; transition: all 0.3s;
} }
}
.mlr-12 {
.table-search-button-group { margin-left: 12px;
display: flex; }
margin-left: 12px;
border: 1px solid var(--el-border-color); .mlr-12 + .el-button {
border-radius: var(--el-border-radius-base); margin-left: 12px;
overflow: hidden; }
button:focus, .table-search {
button:active { display: flex;
background-color: var(--ba-bg-color-overlay); margin-left: auto;
}
.quick-search {
button:hover { width: auto;
background-color: var(--el-color-info-light-7); }
} }
.table-search-button-item { .table-search-button-group {
height: 30px; display: flex;
border: none; margin-left: 12px;
border-radius: 0; border: 1px solid var(--el-border-color);
} border-radius: var(--el-border-radius-base);
overflow: hidden;
.el-button+.el-button {
margin: 0; button:focus,
} button:active {
background-color: var(--ba-bg-color-overlay);
.right-border { }
border-right: 1px solid var(--el-border-color);
} button:hover {
} background-color: var(--el-color-info-light-7);
}
html.dark {
.table-search-button-group { .table-search-button-item {
height: 30px;
button:focus, border: none;
button:active { border-radius: 0;
background-color: var(--el-color-info-dark-2); }
}
.el-button + .el-button {
button:hover { margin: 0;
background-color: var(--el-color-info-light-7); }
}
.right-border {
button { border-right: 1px solid var(--el-border-color);
background-color: var(--ba-bg-color-overlay); }
}
el-icon {
color: white !important; html.dark {
} .table-search-button-group {
} button:focus,
} button:active {
} background-color: var(--el-color-info-dark-2);
}
#header-form,
#header-form-second { button:hover {
:deep(.el-select) { background-color: var(--el-color-info-light-7);
--el-select-width: 220px; }
}
button {
:deep(.el-input) { background-color: var(--ba-bg-color-overlay);
--el-input-width: 220px;
} el-icon {
} color: white !important;
</style> }
}
}
}
#header-form,
#header-form-second {
:deep(.el-select) {
--el-select-width: 220px;
}
:deep(.el-input) {
--el-input-width: 220px;
}
}
</style>

View File

@@ -1,44 +1,24 @@
<template> <template>
<div :style="{ height: tableStore.table.height }"> <div :style="{ height: typeof props.height === 'string' ? props.height : tableStore.table.height }">
<vxe-table <vxe-table ref="tableRef" height="auto" :key="key" :data="tableStore.table.data"
ref="tableRef" v-loading="tableStore.table.loading" v-bind="Object.assign({}, defaultAttribute, $attrs)"
height="auto" @checkbox-all="selectChangeEvent" @checkbox-change="selectChangeEvent" :showOverflow="showOverflow"
:key="key" :sort-config="{ remote: true }" @sort-change="handleSortChange">
:data="tableStore.table.data"
v-loading="tableStore.table.loading"
v-bind="Object.assign({}, defaultAttribute, $attrs)"
@checkbox-all="selectChangeEvent"
@checkbox-change="selectChangeEvent"
:showOverflow="showOverflow"
:sort-config="{ remote: true }"
@sort-change="handleSortChange"
>
<!-- Column 组件内部是 el-table-column --> <!-- Column 组件内部是 el-table-column -->
<template v-if="isGroup"> <template v-if="isGroup">
<GroupColumn :column="tableStore.table.column" /> <GroupColumn :column="tableStore.table.column" />
</template> </template>
<template v-else> <template v-else>
<Column <Column :attr="item" :key="key + '-column'" v-for="(item, key) in tableStore.table.column"
:attr="item" :tree-node="item.treeNode">
:key="key + '-column'"
v-for="(item, key) in tableStore.table.column"
:tree-node="item.treeNode"
>
<!-- tableStore 预设的列 render 方案 --> <!-- tableStore 预设的列 render 方案 -->
<template v-if="item.render" #default="scope"> <template v-if="item.render" #default="scope">
<FieldRender <FieldRender :field="item" :row="scope.row" :column="scope.column" :index="scope.rowIndex" :key="key +
:field="item" '-' +
:row="scope.row" item.render +
:column="scope.column" '-' +
:index="scope.rowIndex" (item.field ? '-' + item.field + '-' + scope.row[item.field] : '')
:key=" " />
key +
'-' +
item.render +
'-' +
(item.field ? '-' + item.field + '-' + scope.row[item.field] : '')
"
/>
</template> </template>
</Column> </Column>
</template> </template>
@@ -47,16 +27,11 @@
</div> </div>
<div v-if="tableStore.showPage" class="table-pagination"> <div v-if="tableStore.showPage" class="table-pagination">
<el-pagination <el-pagination :currentPage="tableStore.table.params!.pageNum" :page-size="tableStore.table.params!.pageSize"
:currentPage="tableStore.table.params!.pageNum" :page-sizes="pageSizes" background
:page-size="tableStore.table.params!.pageSize"
:page-sizes="pageSizes"
background
:layout="config.layout.shrink ? 'prev, next, jumper' : 'sizes,total, ->, prev, pager, next, jumper'" :layout="config.layout.shrink ? 'prev, next, jumper' : 'sizes,total, ->, prev, pager, next, jumper'"
:total="tableStore.table.total" :total="tableStore.table.total" @size-change="onTableSizeChange"
@size-change="onTableSizeChange" @current-change="onTableCurrentChange"></el-pagination>
@current-change="onTableCurrentChange"
></el-pagination>
</div> </div>
<slot name="footer"></slot> <slot name="footer"></slot>
</template> </template>
@@ -81,11 +56,13 @@ const key = ref(0)
interface Props extends /* @vue-ignore */ Partial<InstanceType<typeof ElTable>> { interface Props extends /* @vue-ignore */ Partial<InstanceType<typeof ElTable>> {
isGroup?: boolean isGroup?: boolean
showOverflow?: boolean showOverflow?: boolean
height?: string | number
} }
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
isGroup: false, isGroup: false,
showOverflow: true showOverflow: true,
height: undefined
}) })
onMounted(() => { onMounted(() => {
tableStore.table.ref = tableRef.value as VxeTableInstance tableStore.table.ref = tableRef.value as VxeTableInstance
@@ -119,7 +96,7 @@ const handleSortChange = ({ field, order }: any) => {
return a[field] < b[field] ? 1 : -1 return a[field] < b[field] ? 1 : -1
} }
}) })
if (tableStore.isWebPaging) { if (tableStore.isWebPaging) {
tableStore.table.data = JSON.parse( tableStore.table.data = JSON.parse(
JSON.stringify( JSON.stringify(
@@ -148,6 +125,7 @@ watch(
() => tableStore.table.allFlag, () => tableStore.table.allFlag,
newVal => { newVal => {
if (tableStore.table.allFlag) { if (tableStore.table.allFlag) {
tableRef.value?.exportData({ tableRef.value?.exportData({
filename: tableStore.exportName || document.querySelectorAll('.ba-nav-tab.active')[0].textContent || '', // 文件名字 filename: tableStore.exportName || document.querySelectorAll('.ba-nav-tab.active')[0].textContent || '', // 文件名字
sheetName: 'Sheet1', sheetName: 'Sheet1',
@@ -207,7 +185,5 @@ defineExpose({
min-width: 128px; min-width: 128px;
} }
} }
</style> </style>
<!-- @/components/table/column/GroupColumn.vue@/components/table/column/GroupColumn.vue --> <!-- @/components/table/column/GroupColumn.vue@/components/table/column/GroupColumn.vue -->

355
src/styles/app.css Normal file
View File

@@ -0,0 +1,355 @@
@charset "UTF-8";
/* 基本样式 */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
outline: none !important;
}
html,
body,
#app {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, SimSun, sans-serif;
font-weight: 400;
-webkit-font-smoothing: antialiased;
-webkit-tap-highlight-color: transparent;
background-color: var(--ba-bg-color);
font-size: 14px;
overflow: hidden;
position: relative;
}
/* 修改纵向滚动条轨道 */
::-webkit-scrollbar {
width: 8px;
}
/* 修改纵向滚动条拇指thumb */
::-webkit-scrollbar-thumb {
background-color: var(--el-color-primary);
border-radius: 5px;
cursor: pointer !important;
}
/* 修改横向滚动条轨道 */
::-webkit-scrollbar:horizontal {
height: 8px;
}
/* 修改横向滚动条拇指thumb */
::-webkit-scrollbar-thumb:horizontal {
background-color: var(--el-color-primary);
border-radius: 5px;
}
.iconfont-icon {
width: 1em;
height: 1em;
vertical-align: -0.15em;
fill: currentColor;
overflow: hidden;
}
.w100 {
width: 100% !important;
}
.h100 {
height: 100% !important;
}
.ba-center {
display: flex;
align-items: center;
justify-content: center;
}
.default-main {
position: relative;
background: #fff;
margin: var(--ba-main-space) var(--ba-main-space) 0px var(--ba-main-space);
}
.form-one {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.form-one .el-form-item {
display: flex;
width: 98%;
margin-bottom: 15px !important;
}
.form-one .el-form-item .el-form-item__content {
flex: 1;
}
.form-one .el-form-item .el-form-item__content .el-select,
.form-one .el-form-item .el-form-item__content .el-cascader,
.form-one .el-form-item .el-form-item__content .el-input__inner,
.form-one .el-form-item .el-form-item__content .el-date-editor {
width: 100%;
}
.form-two {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.form-two .el-form-item {
display: flex;
width: 48%;
}
.form-two .el-form-item .el-form-item__content {
flex: 1;
}
.form-two .el-form-item .el-form-item__content .el-select,
.form-two .el-form-item .el-form-item__content .el-cascader,
.form-two .el-form-item .el-form-item__content .el-input__inner,
.form-two .el-form-item .el-form-item__content .el-date-editor {
width: 100%;
}
.uploadFile .el-form-item__content {
line-height: 20px !important;
}
.uploadFile .el-form-item__content div {
display: flex !important;
align-items: center !important;
}
.uploadFile .el-form-item__content .el-upload-list__item-name {
width: 150px !important;
}
.uploadFile .el-form-item__content .el-upload-list--text {
margin: 0px 20px 0 !important;
}
.zoom-handle {
position: absolute;
width: 20px;
height: 20px;
bottom: -10px;
right: -10px;
cursor: se-resize;
}
.block-help {
display: block;
width: 100%;
color: #909399;
font-size: 13px;
line-height: 16px;
padding-top: 5px;
}
/* 表格顶部菜单-s */
.table-header .table-header-operate .icon {
font-size: 14px !important;
color: var(--el-color-white) !important;
}
.table-header .el-button.is-disabled .icon {
color: var(--el-button-disabled-text-color) !important;
}
/* 表格顶部菜单-e */
/* 鼠标置入浮动效果-s */
.suspension {
transition: all 0.3s ease;
}
.suspension:hover {
-webkit-transform: translateY(-4px) scale(1.02);
-moz-transform: translateY(-4px) scale(1.02);
-ms-transform: translateY(-4px) scale(1.02);
-o-transform: translateY(-4px) scale(1.02);
transform: translateY(-4px) scale(1.02);
-webkit-box-shadow: 0 14px 24px rgba(0, 0, 0, 0.2);
box-shadow: 0 14px 24px rgba(0, 0, 0, 0.2);
z-index: 999;
border-radius: 6px;
}
/* 鼠标置入浮动效果-e */
/* 表格-s */
.ba-table-box {
border-radius: var(--el-border-radius-round);
}
.ba-table-alert {
background-color: var(--el-fill-color-darker) !important;
border: 1px solid var(--ba-boder-color);
border-bottom: 0;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
/* 表格-e */
.ba-operate-form {
padding-top: 20px;
}
/* 新增/编辑表单-e */
/* 全局遮罩-s */
.ba-layout-shade {
position: fixed;
top: 0;
left: 0;
height: 100vh;
width: 100vw;
background-color: rgba(0, 0, 0, 0.5);
z-index: 9999990;
}
/* 全局遮罩-e */
/* 图片上传预览-s */
.img-preview-dialog .el-dialog__body {
display: flex;
align-items: center;
justify-content: center;
}
.img-preview-dialog .el-dialog__body img {
max-width: 100%;
}
/* 图片上传预览-e */
/* 页面切换动画-s */
.slide-right-enter-active,
.slide-right-leave-active,
.slide-left-enter-active,
.slide-left-leave-active {
will-change: transform;
transition: all 0.3s ease;
}
.slide-right-enter-from, .slide-left-leave-to {
opacity: 0;
transform: translateX(-20px);
}
.slide-right-leave-to, .slide-left-enter-from {
opacity: 0;
transform: translateX(20px);
}
/* 页面切换动画-e */
/* 布局相关-s */
.frontend-footer-brother {
min-height: calc(100vh - 120px);
}
.user-views {
padding-left: 15px;
}
.user-views .user-views-card {
margin-bottom: 15px;
}
.ba-aside-drawer .el-drawer__body {
padding: 0;
}
/* 布局相关-e */
/* 暗黑模式公共样式-s */
.ba-icon-dark {
color: var(--el-text-color-primary) !important;
}
/* 暗黑模式公共样式-e */
/* NProgress-s */
#nprogress .bar,
#nprogress .spinner {
z-index: 999999;
}
/* NProgress-e */
/* 自适应-s */
@media screen and (max-width: 768px) {
.xs-hidden {
display: none;
}
}
@media screen and (max-width: 1024px) {
.cn-operate-dialog {
width: 96%;
}
}
@media screen and (max-width: 991px) {
.user-views {
padding: 0;
}
}
/* 自适应-e */
.custom-table-header {
box-sizing: border-box;
display: flex;
padding: 13px 15px;
align-items: center;
border: 1px solid var(--el-border-color);
}
.custom-table-header .title {
flex: 1;
font-weight: 700;
}
.custom-table-header .el-form-item {
margin-bottom: 0 !important;
}
.child-router {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
background: #fff;
z-index: 10;
}
.bjs-powered-by {
display: none;
}
.el-select__wrapper {
height: 32px !important;
}
@font-face {
font-family: 'AlimamaFangYuanTiVF';
src: url("../assets/font/ali/AlimamaFangYuanTiVF-Thin.woff") format("woff"), url("../assets/font/ali/AlimamaFangYuanTiVF-Thin.woff2") format("woff2");
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'nablaRegular';
src: url("../assets/font/ali/Nabla_Regular.woff") format("woff"), url("../assets/font/ali/Nabla_Regular.woff2") format("woff2");
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'AlimamaDongFangDaKai';
src: url("../assets/font/ali/AlimamaDongFangDaKai-Regular.woff") format("woff"), url("../assets/font/ali/AlimamaDongFangDaKai-Regular.woff2") format("woff2");
font-weight: normal;
font-style: normal;
}

1
src/styles/app.min.css vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -1,415 +1,416 @@
/* 基本样式 */ /* 基本样式 */
* { * {
margin: 0; margin: 0;
padding: 0; padding: 0;
box-sizing: border-box; box-sizing: border-box;
outline: none !important; outline: none !important;
} }
html, html,
body, body,
#app { #app {
margin: 0; margin: 0;
padding: 0; padding: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, SimSun, sans-serif; font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, SimSun, sans-serif;
font-weight: 400; font-weight: 400;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-webkit-tap-highlight-color: transparent; -webkit-tap-highlight-color: transparent;
background-color: var(--ba-bg-color); background-color: var(--ba-bg-color);
font-size: 14px; font-size: 14px;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
} }
/* 修改纵向滚动条轨道 */ /* 修改纵向滚动条轨道 */
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 8px; width: 8px;
} }
/* 修改纵向滚动条拇指thumb */ /* 修改纵向滚动条拇指thumb */
::-webkit-scrollbar-thumb { ::-webkit-scrollbar-thumb {
background-color: var(--el-color-primary); background-color: var(--el-color-primary);
border-radius: 5px; border-radius: 5px;
} cursor: pointer !important;
/* 修改横向滚动条轨道 */ }
::-webkit-scrollbar:horizontal { /* 修改横向滚动条轨道 */
height: 8px; ::-webkit-scrollbar:horizontal {
} height: 8px;
/* 修改横向滚动条拇指thumb */ }
::-webkit-scrollbar-thumb:horizontal { /* 修改横向滚动条拇指thumb */
background-color: var(--el-color-primary); ::-webkit-scrollbar-thumb:horizontal {
border-radius: 5px; background-color: var(--el-color-primary);
} border-radius: 5px;
// 阿里 iconfont Symbol引用css }
.iconfont-icon { // 阿里 iconfont Symbol引用css
width: 1em; .iconfont-icon {
height: 1em; width: 1em;
vertical-align: -0.15em; height: 1em;
fill: currentColor; vertical-align: -0.15em;
overflow: hidden; fill: currentColor;
} overflow: hidden;
}
.w100 {
width: 100% !important; .w100 {
} width: 100% !important;
}
.h100 {
height: 100% !important; .h100 {
} height: 100% !important;
}
.ba-center {
display: flex; .ba-center {
align-items: center; display: flex;
justify-content: center; align-items: center;
} justify-content: center;
}
.default-main {
position: relative; .default-main {
background: #fff; position: relative;
margin: var(--ba-main-space) var(--ba-main-space) 0px var(--ba-main-space); background: #fff;
} margin: var(--ba-main-space) var(--ba-main-space) 0px var(--ba-main-space);
}
.form-one {
display: flex; .form-one {
flex-wrap: wrap; display: flex;
justify-content: space-between; flex-wrap: wrap;
.el-form-item { justify-content: space-between;
display: flex; .el-form-item {
width: 98%; display: flex;
margin-bottom: 15px !important; width: 98%;
.el-form-item__content { margin-bottom: 15px !important;
flex: 1; .el-form-item__content {
.el-select, flex: 1;
.el-cascader, .el-select,
.el-input__inner, .el-cascader,
.el-date-editor { .el-input__inner,
width: 100%; .el-date-editor {
} width: 100%;
} }
} }
} }
.form-two { }
display: flex; .form-two {
flex-wrap: wrap; display: flex;
justify-content: space-between; flex-wrap: wrap;
.el-form-item { justify-content: space-between;
display: flex; .el-form-item {
width: 48%; display: flex;
.el-form-item__content { width: 48%;
flex: 1; .el-form-item__content {
.el-select, flex: 1;
.el-cascader, .el-select,
.el-input__inner, .el-cascader,
.el-date-editor { .el-input__inner,
width: 100%; .el-date-editor {
} width: 100%;
} }
} }
} }
//修改上传文件filelist位置 }
.uploadFile { //修改上传文件filelist位置
.el-form-item__content { .uploadFile {
line-height: 20px !important; .el-form-item__content {
div { line-height: 20px !important;
display: flex !important; div {
align-items: center !important; display: flex !important;
} align-items: center !important;
.el-upload-list__item-name { }
width: 150px !important; .el-upload-list__item-name {
} width: 150px !important;
.el-upload-list--text { }
margin: 0px 20px 0 !important; .el-upload-list--text {
} margin: 0px 20px 0 !important;
} }
} }
.zoom-handle { }
position: absolute; .zoom-handle {
width: 20px; position: absolute;
height: 20px; width: 20px;
bottom: -10px; height: 20px;
right: -10px; bottom: -10px;
cursor: se-resize; right: -10px;
} cursor: se-resize;
}
.block-help {
display: block; .block-help {
width: 100%; display: block;
color: #909399; width: 100%;
font-size: 13px; color: #909399;
line-height: 16px; font-size: 13px;
padding-top: 5px; line-height: 16px;
} padding-top: 5px;
}
/* 表格顶部菜单-s */
.table-header { /* 表格顶部菜单-s */
.table-header-operate .icon { .table-header {
font-size: 14px !important; .table-header-operate .icon {
color: var(--el-color-white) !important; font-size: 14px !important;
} color: var(--el-color-white) !important;
}
.el-button.is-disabled .icon {
color: var(--el-button-disabled-text-color) !important; .el-button.is-disabled .icon {
} color: var(--el-button-disabled-text-color) !important;
} }
}
/* 表格顶部菜单-e */
/* 表格顶部菜单-e */
/* 鼠标置入浮动效果-s */
.suspension { /* 鼠标置入浮动效果-s */
transition: all 0.3s ease; .suspension {
} transition: all 0.3s ease;
}
.suspension:hover {
-webkit-transform: translateY(-4px) scale(1.02); .suspension:hover {
-moz-transform: translateY(-4px) scale(1.02); -webkit-transform: translateY(-4px) scale(1.02);
-ms-transform: translateY(-4px) scale(1.02); -moz-transform: translateY(-4px) scale(1.02);
-o-transform: translateY(-4px) scale(1.02); -ms-transform: translateY(-4px) scale(1.02);
transform: translateY(-4px) scale(1.02); -o-transform: translateY(-4px) scale(1.02);
-webkit-box-shadow: 0 14px 24px rgba(0, 0, 0, 0.2); transform: translateY(-4px) scale(1.02);
box-shadow: 0 14px 24px rgba(0, 0, 0, 0.2); -webkit-box-shadow: 0 14px 24px rgba(0, 0, 0, 0.2);
z-index: 999; box-shadow: 0 14px 24px rgba(0, 0, 0, 0.2);
border-radius: 6px; z-index: 999;
} border-radius: 6px;
}
/* 鼠标置入浮动效果-e */
/* 鼠标置入浮动效果-e */
/* 表格-s */
.ba-table-box { /* 表格-s */
border-radius: var(--el-border-radius-round); .ba-table-box {
} border-radius: var(--el-border-radius-round);
}
.ba-table-alert {
background-color: var(--el-fill-color-darker) !important; .ba-table-alert {
border: 1px solid var(--ba-boder-color); background-color: var(--el-fill-color-darker) !important;
border-bottom: 0; border: 1px solid var(--ba-boder-color);
border-bottom-left-radius: 0; border-bottom: 0;
border-bottom-right-radius: 0; border-bottom-left-radius: 0;
} border-bottom-right-radius: 0;
}
/* 表格-e */
/* 表格-e */
// /* 新增/编辑表单-s */
// .cn-operate-dialog { // /* 新增/编辑表单-s */
// overflow: hidden; // .cn-operate-dialog {
// border-radius: var(--el-border-radius-base); // overflow: hidden;
// } // border-radius: var(--el-border-radius-base);
// }
// .cn-operate-dialog .el-dialog__header {
// padding-bottom: 16px; // .cn-operate-dialog .el-dialog__header {
// border-bottom: 1px solid var(--ba-bg-color); // padding-bottom: 16px;
// } // border-bottom: 1px solid var(--ba-bg-color);
// }
// .cn-operate-dialog .el-dialog__body {
// max-height: 60vh; // .cn-operate-dialog .el-dialog__body {
// padding-top: 20px; // max-height: 60vh;
// padding-bottom: 52px; // padding-top: 20px;
// } // padding-bottom: 52px;
// }
// .cn-operate-dialog .el-dialog__body .el-scrollbar {
// // padding-right: 60px; // .cn-operate-dialog .el-dialog__body .el-scrollbar {
// } // // padding-right: 60px;
// }
// .cn-operate-dialog .el-dialog__footer {
// padding: 15px; // .cn-operate-dialog .el-dialog__footer {
// box-shadow: var(--el-box-shadow); // padding: 15px;
// position: absolute; // box-shadow: var(--el-box-shadow);
// width: 100%; // position: absolute;
// bottom: 0; // width: 100%;
// } // bottom: 0;
// }
// .cn-operate-dialog .el-form {
// width: calc(100% - 60px); // .cn-operate-dialog .el-form {
// } // width: calc(100% - 60px);
// }
// .cn-operate-dialog .el-form--inline {
// display: grid; // .cn-operate-dialog .el-form--inline {
// grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); // display: grid;
// grid-gap: 20px 10px; // grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
// grid-gap: 20px 10px;
// .el-form-item {
// margin-right: 0; // .el-form-item {
// margin-bottom: 0; // margin-right: 0;
// } // margin-bottom: 0;
// } // }
// }
// .cn-operate-dialog .el-form--inline .el-select {
// width: 100%; // .cn-operate-dialog .el-form--inline .el-select {
// } // width: 100%;
// }
.ba-operate-form {
padding-top: 20px; .ba-operate-form {
} padding-top: 20px;
}
/* 新增/编辑表单-e */
/* 新增/编辑表单-e */
/* 全局遮罩-s */
.ba-layout-shade { /* 全局遮罩-s */
position: fixed; .ba-layout-shade {
top: 0; position: fixed;
left: 0; top: 0;
height: 100vh; left: 0;
width: 100vw; height: 100vh;
background-color: rgba(0, 0, 0, 0.5); width: 100vw;
z-index: 9999990; background-color: rgba(0, 0, 0, 0.5);
} z-index: 9999990;
}
/* 全局遮罩-e */
/* 全局遮罩-e */
/* 图片上传预览-s */
.img-preview-dialog .el-dialog__body { /* 图片上传预览-s */
display: flex; .img-preview-dialog .el-dialog__body {
align-items: center; display: flex;
justify-content: center; align-items: center;
justify-content: center;
img {
max-width: 100%; img {
} max-width: 100%;
} }
}
/* 图片上传预览-e */
/* 图片上传预览-e */
/* 页面切换动画-s */
.slide-right-enter-active, /* 页面切换动画-s */
.slide-right-leave-active, .slide-right-enter-active,
.slide-left-enter-active, .slide-right-leave-active,
.slide-left-leave-active { .slide-left-enter-active,
will-change: transform; .slide-left-leave-active {
transition: all 0.3s ease; will-change: transform;
} transition: all 0.3s ease;
}
// slide-right
.slide-right-enter-from { // slide-right
opacity: 0; .slide-right-enter-from {
transform: translateX(-20px); opacity: 0;
} transform: translateX(-20px);
}
.slide-right-leave-to {
opacity: 0; .slide-right-leave-to {
transform: translateX(20px); opacity: 0;
} transform: translateX(20px);
}
// slide-left
.slide-left-enter-from { // slide-left
@extend .slide-right-leave-to; .slide-left-enter-from {
} @extend .slide-right-leave-to;
}
.slide-left-leave-to {
@extend .slide-right-enter-from; .slide-left-leave-to {
} @extend .slide-right-enter-from;
}
/* 页面切换动画-e */
/* 页面切换动画-e */
/* 布局相关-s */
.frontend-footer-brother { /* 布局相关-s */
min-height: calc(100vh - 120px); .frontend-footer-brother {
} min-height: calc(100vh - 120px);
}
.user-views {
padding-left: 15px; .user-views {
padding-left: 15px;
.user-views-card {
margin-bottom: 15px; .user-views-card {
} margin-bottom: 15px;
} }
}
.ba-aside-drawer {
.el-drawer__body { .ba-aside-drawer {
padding: 0; .el-drawer__body {
} padding: 0;
} }
}
/* 布局相关-e */
/* 布局相关-e */
/* 暗黑模式公共样式-s */
.ba-icon-dark { /* 暗黑模式公共样式-s */
color: var(--el-text-color-primary) !important; .ba-icon-dark {
} color: var(--el-text-color-primary) !important;
}
/* 暗黑模式公共样式-e */
/* 暗黑模式公共样式-e */
/* NProgress-s */
#nprogress { /* NProgress-s */
.bar, #nprogress {
.spinner { .bar,
z-index: 999999; .spinner {
} z-index: 999999;
} }
}
/* NProgress-e */
/* NProgress-e */
/* 自适应-s */
@media screen and (max-width: 768px) { /* 自适应-s */
.xs-hidden { @media screen and (max-width: 768px) {
display: none; .xs-hidden {
} display: none;
} }
}
@media screen and (max-width: 1024px) {
.cn-operate-dialog { @media screen and (max-width: 1024px) {
width: 96%; .cn-operate-dialog {
} width: 96%;
} }
}
@media screen and (max-width: 991px) {
.user-views { @media screen and (max-width: 991px) {
padding: 0; .user-views {
} padding: 0;
} }
}
/* 自适应-e */
/* 自适应-e */
.custom-table-header {
box-sizing: border-box; .custom-table-header {
display: flex; box-sizing: border-box;
padding: 13px 15px; display: flex;
align-items: center; padding: 13px 15px;
border: 1px solid var(--el-border-color); align-items: center;
.title { border: 1px solid var(--el-border-color);
flex: 1; .title {
font-weight: 700; flex: 1;
} font-weight: 700;
.el-form-item { }
margin-bottom: 0 !important; .el-form-item {
} margin-bottom: 0 !important;
} }
}
.child-router {
position: absolute; .child-router {
top: 0; position: absolute;
left: 0; top: 0;
height: 100%; left: 0;
width: 100%; height: 100%;
background: #fff; width: 100%;
z-index: 10; background: #fff;
} z-index: 10;
.bjs-powered-by { }
display: none; .bjs-powered-by {
} display: none;
.el-select__wrapper{ }
height: 32px !important; .el-select__wrapper{
} height: 32px !important;
@font-face { }
font-family: 'AlimamaFangYuanTiVF'; @font-face {
src: url('../assets/font/ali/AlimamaFangYuanTiVF-Thin.woff') format('woff'), font-family: 'AlimamaFangYuanTiVF';
url('../assets/font/ali/AlimamaFangYuanTiVF-Thin.woff2') format('woff2'); src: url('../assets/font/ali/AlimamaFangYuanTiVF-Thin.woff') format('woff'),
font-weight: normal; url('../assets/font/ali/AlimamaFangYuanTiVF-Thin.woff2') format('woff2');
font-style: normal; font-weight: normal;
} font-style: normal;
}
//阿里变形字体
@font-face { //阿里变形字体
font-family: 'nablaRegular'; @font-face {
src: url('../assets/font/ali/Nabla_Regular.woff') format('woff'), font-family: 'nablaRegular';
url('../assets/font/ali/Nabla_Regular.woff2') format('woff2'); src: url('../assets/font/ali/Nabla_Regular.woff') format('woff'),
font-weight: normal; url('../assets/font/ali/Nabla_Regular.woff2') format('woff2');
font-style: normal; font-weight: normal;
} font-style: normal;
}
@font-face {
font-family: 'AlimamaDongFangDaKai'; @font-face {
src: url('../assets/font/ali/AlimamaDongFangDaKai-Regular.woff') format('woff'), font-family: 'AlimamaDongFangDaKai';
url('../assets/font/ali/AlimamaDongFangDaKai-Regular.woff2') format('woff2'); src: url('../assets/font/ali/AlimamaDongFangDaKai-Regular.woff') format('woff'),
font-weight: normal; url('../assets/font/ali/AlimamaDongFangDaKai-Regular.woff2') format('woff2');
font-style: normal; font-weight: normal;
} font-style: normal;
}

247
src/styles/element.css Normal file
View File

@@ -0,0 +1,247 @@
@charset "UTF-8";
/* 修复 Chrome 浏览器输入框内选中字符行高异常的bug-s */
.el-input .el-input__inner {
height: 30px;
line-height: calc(var(--el-input-height, 40px) - 4px);
}
/* 修复 Chrome 浏览器输入框内选中字符行高异常的bug-e */
.datetime-picker {
height: 32px;
padding-top: 0;
padding-bottom: 0;
}
.el-divider__text.is-center {
transform: translateX(-50%) translateY(-62%);
}
.el-menu {
user-select: none;
}
.el-menu .el-menu-item:hover,
.el-menu .el-sub-menu__title:hover {
background-color: var(--el-menu-hover-color) !important;
color: var(--el-menu-active-color) !important;
}
.el-menu .el-menu-item:hover .icon,
.el-menu .el-sub-menu__title:hover .icon {
color: var(--el-menu-active-color) !important;
}
.el-select {
min-width: 200px;
}
.el-dialog {
padding: 0px !important;
}
.el-dialog .el-dialog__footer {
padding: 15px;
box-shadow: var(--el-box-shadow);
width: 100%;
bottom: 0;
}
.el-dialog__body {
max-height: 60vh;
overflow-y: auto;
padding: 10px;
}
.el-dialog__header {
background: var(--el-color-primary);
padding: 15px;
margin-right: 0px;
}
.el-dialog__header .el-dialog__headerbtn {
top: 5px;
}
.el-dialog__header .el-dialog__headerbtn .el-icon {
color: var(--el-color-white);
}
.el-dialog__header .el-dialog__headerbtn:hover .el-icon {
color: #409eff;
}
.el-dialog__header .el-dialog__title {
color: var(--el-color-white);
}
.el-table {
--el-table-border-color: var(--ba-border-color);
}
.el-card {
border: none;
}
.el-card__header {
border-bottom: 1px solid var(--el-border-color-extra-light);
}
.el-textarea__inner {
padding: 5px 11px;
}
/* dialog滚动条-s */
.el-overlay-dialog,
.el-tabs__content,
.ba-scroll-style {
scrollbar-width: none;
}
.el-overlay-dialog::-webkit-scrollbar,
.el-tabs__content::-webkit-scrollbar,
.ba-scroll-style::-webkit-scrollbar {
width: 5px;
height: 5px;
}
.el-overlay-dialog::-webkit-scrollbar-thumb,
.el-tabs__content::-webkit-scrollbar-thumb,
.ba-scroll-style::-webkit-scrollbar-thumb {
background: #eaeaea;
border-radius: var(--el-border-radius-base);
box-shadow: none;
-webkit-box-shadow: none;
cursor: pointer !important;
}
.el-overlay-dialog:hover::-webkit-scrollbar-thumb:hover,
.el-tabs__content:hover::-webkit-scrollbar-thumb:hover,
.ba-scroll-style:hover::-webkit-scrollbar-thumb:hover {
background: #c8c9cc;
}
/* dialog滚动条-e */
/* 小屏设备 el-radio-group 样式优化-s */
.ba-input-item-radio {
margin-bottom: 10px;
}
.ba-input-item-radio .el-radio-group .el-radio {
margin-bottom: 8px;
}
/* 小屏设备 el-radio-group 样式调整-e */
.el-tabs--card > .el-tabs__header .el-tabs__item.is-active {
background: var(--el-color-primary);
color: var(--el-color-white);
}
.el-tabs__header {
margin-bottom: 0;
}
.el-form--inline .el-form-item {
margin-bottom: 10px;
}
.el-tabs--border-card > .el-tabs__content {
padding: 10px;
}
.el-page-header__header {
line-height: 32px;
}
.el-page-header__header .el-page-header__content {
font-size: 14px;
font-weight: 700;
}
.el-tabs__content {
height: calc(100% - 40px);
}
.el-tabs__content .el-tab-pane {
height: 100%;
}
.el-button--primary:focus {
color: var(--el-color-white);
outline: 0;
}
.el-button--primary:hover {
color: var(--el-color-white);
border-color: var(--el-color-primary-light-3);
background-color: var(--el-color-primary-light-3);
outline: 0;
}
.el-button.is-plain:focus {
color: var(--el-button-text-color);
border-color: var(--el-button-border-color);
}
.el-button.is-plain:hover {
color: var(--el-color-primary);
border-color: var(--el-color-primary);
}
.el-button.is-link:focus {
color: var(--el-button-text-color);
}
.el-button.is-link:hover {
color: var(--el-button-hover-link-text-color);
}
.el-button--primary.is-link:hover,
.el-button--primary.is-plain:hover,
.el-button--primary.is-text:hover {
color: var(--el-color-primary-light-5);
background-color: var(--el-color-primary-light-9) !important;
}
.el-divider--horizontal {
margin: 15px 0;
}
.el-step__title {
cursor: pointer;
}
.el-checkbox__input.is-disabled.is-checked .el-checkbox__inner,
.el-radio__input.is-disabled.is-checked .el-radio__inner {
background-color: var(--el-color-primary);
opacity: 0.6;
}
.sgmap-ctrl-bottom-left {
display: none !important;
}
.el-drawer__header {
margin-bottom: 0 !important;
}
.custom-tabs-label {
display: flex;
align-items: center;
justify-content: space-between;
}
.custom-tabs-label .el-icon {
margin-right: 5px;
}
.el-pagination__sizes .el-select {
min-width: 128px;
}
.el-collapse-item__content {
padding-bottom: 0;
}
.el-popup-parent--hidden {
width: 100% !important;
}

1
src/styles/element.min.css vendored Normal file
View File

@@ -0,0 +1 @@
.el-input .el-input__inner{height:30px;line-height:calc(var(--el-input-height, 40px) - 4px)}.datetime-picker{height:32px;padding-top:0;padding-bottom:0}.el-divider__text.is-center{transform:translateX(-50%) translateY(-62%)}.el-menu{user-select:none}.el-menu .el-menu-item:hover,.el-menu .el-sub-menu__title:hover{background-color:var(--el-menu-hover-color) !important;color:var(--el-menu-active-color) !important}.el-menu .el-menu-item:hover .icon,.el-menu .el-sub-menu__title:hover .icon{color:var(--el-menu-active-color) !important}.el-select{min-width:200px}.el-dialog{padding:0px !important}.el-dialog .el-dialog__footer{padding:15px;box-shadow:var(--el-box-shadow);width:100%;bottom:0}.el-dialog__body{max-height:60vh;overflow-y:auto;padding:10px}.el-dialog__header{background:var(--el-color-primary);padding:15px;margin-right:0px}.el-dialog__header .el-dialog__headerbtn{top:5px}.el-dialog__header .el-dialog__headerbtn .el-icon{color:var(--el-color-white)}.el-dialog__header .el-dialog__headerbtn:hover .el-icon{color:#409eff}.el-dialog__header .el-dialog__title{color:var(--el-color-white)}.el-table{--el-table-border-color:var(--ba-border-color)}.el-card{border:none}.el-card__header{border-bottom:1px solid var(--el-border-color-extra-light)}.el-textarea__inner{padding:5px 11px}.el-overlay-dialog,.el-tabs__content,.ba-scroll-style{scrollbar-width:none}.el-overlay-dialog::-webkit-scrollbar,.el-tabs__content::-webkit-scrollbar,.ba-scroll-style::-webkit-scrollbar{width:5px;height:5px}.el-overlay-dialog::-webkit-scrollbar-thumb,.el-tabs__content::-webkit-scrollbar-thumb,.ba-scroll-style::-webkit-scrollbar-thumb{background:#eaeaea;border-radius:var(--el-border-radius-base);box-shadow:none;-webkit-box-shadow:none;cursor:pointer !important}.el-overlay-dialog:hover::-webkit-scrollbar-thumb:hover,.el-tabs__content:hover::-webkit-scrollbar-thumb:hover,.ba-scroll-style:hover::-webkit-scrollbar-thumb:hover{background:#c8c9cc}.ba-input-item-radio{margin-bottom:10px}.ba-input-item-radio .el-radio-group .el-radio{margin-bottom:8px}.el-tabs--card>.el-tabs__header .el-tabs__item.is-active{background:var(--el-color-primary);color:var(--el-color-white)}.el-tabs__header{margin-bottom:0}.el-form--inline .el-form-item{margin-bottom:10px}.el-tabs--border-card>.el-tabs__content{padding:10px}.el-page-header__header{line-height:32px}.el-page-header__header .el-page-header__content{font-size:14px;font-weight:700}.el-tabs__content{height:calc(100% - 40px)}.el-tabs__content .el-tab-pane{height:100%}.el-button--primary:focus{color:var(--el-color-white);outline:0}.el-button--primary:hover{color:var(--el-color-white);border-color:var(--el-color-primary-light-3);background-color:var(--el-color-primary-light-3);outline:0}.el-button.is-plain:focus{color:var(--el-button-text-color);border-color:var(--el-button-border-color)}.el-button.is-plain:hover{color:var(--el-color-primary);border-color:var(--el-color-primary)}.el-button.is-link:focus{color:var(--el-button-text-color)}.el-button.is-link:hover{color:var(--el-button-hover-link-text-color)}.el-button--primary.is-link:hover,.el-button--primary.is-plain:hover,.el-button--primary.is-text:hover{color:var(--el-color-primary-light-5);background-color:var(--el-color-primary-light-9) !important}.el-divider--horizontal{margin:15px 0}.el-step__title{cursor:pointer}.el-checkbox__input.is-disabled.is-checked .el-checkbox__inner,.el-radio__input.is-disabled.is-checked .el-radio__inner{background-color:var(--el-color-primary);opacity:0.6}.sgmap-ctrl-bottom-left{display:none !important}.el-drawer__header{margin-bottom:0 !important}.custom-tabs-label{display:flex;align-items:center;justify-content:space-between}.custom-tabs-label .el-icon{margin-right:5px}.el-pagination__sizes .el-select{min-width:128px}.el-collapse-item__content{padding-bottom:0}.el-popup-parent--hidden{width:100% !important}

View File

@@ -1,237 +1,238 @@
/* 修复 Chrome 浏览器输入框内选中字符行高异常的bug-s */ /* 修复 Chrome 浏览器输入框内选中字符行高异常的bug-s */
.el-input .el-input__inner { .el-input .el-input__inner {
height: 30px; height: 30px;
line-height: calc(var(--el-input-height, 40px) - 4px); line-height: calc(var(--el-input-height, 40px) - 4px);
} }
/* 修复 Chrome 浏览器输入框内选中字符行高异常的bug-e */ /* 修复 Chrome 浏览器输入框内选中字符行高异常的bug-e */
.datetime-picker { .datetime-picker {
height: 32px; height: 32px;
padding-top: 0; padding-top: 0;
padding-bottom: 0; padding-bottom: 0;
} }
.el-divider__text.is-center { .el-divider__text.is-center {
transform: translateX(-50%) translateY(-62%); transform: translateX(-50%) translateY(-62%);
} }
.el-menu { .el-menu {
user-select: none; user-select: none;
.el-menu-item:hover, .el-menu-item:hover,
.el-sub-menu__title:hover { .el-sub-menu__title:hover {
background-color: var(--el-menu-hover-color) !important; background-color: var(--el-menu-hover-color) !important;
color: var(--el-menu-active-color) !important; color: var(--el-menu-active-color) !important;
.icon { .icon {
color: var(--el-menu-active-color) !important; color: var(--el-menu-active-color) !important;
} }
} }
} }
.el-select { .el-select {
min-width: 200px; min-width: 200px;
} }
.el-dialog { .el-dialog {
padding: 0px !important; padding: 0px !important;
.el-dialog__footer { .el-dialog__footer {
padding: 15px; padding: 15px;
box-shadow: var(--el-box-shadow); box-shadow: var(--el-box-shadow);
width: 100%; width: 100%;
bottom: 0; bottom: 0;
} }
} }
.el-dialog__body { .el-dialog__body {
max-height: 60vh; max-height: 60vh;
overflow-y: auto; overflow-y: auto;
padding: 10px; padding: 10px;
} }
.el-dialog__header { .el-dialog__header {
background: var(--el-color-primary); background: var(--el-color-primary);
padding: 15px; padding: 15px;
margin-right: 0px; margin-right: 0px;
.el-dialog__headerbtn { .el-dialog__headerbtn {
top: 5px; top: 5px;
.el-icon { .el-icon {
color: var(--el-color-white); color: var(--el-color-white);
} }
} }
.el-dialog__headerbtn:hover { .el-dialog__headerbtn:hover {
.el-icon { .el-icon {
color: #409eff; color: #409eff;
} }
} }
.el-dialog__title { .el-dialog__title {
color: var(--el-color-white); color: var(--el-color-white);
} }
} }
.el-table { .el-table {
--el-table-border-color: var(--ba-border-color); --el-table-border-color: var(--ba-border-color);
} }
.el-card { .el-card {
border: none; border: none;
} }
.el-card__header { .el-card__header {
border-bottom: 1px solid var(--el-border-color-extra-light); border-bottom: 1px solid var(--el-border-color-extra-light);
} }
.el-textarea__inner { .el-textarea__inner {
padding: 5px 11px; padding: 5px 11px;
} }
/* dialog滚动条-s */ /* dialog滚动条-s */
.el-overlay-dialog, .el-overlay-dialog,
.el-tabs__content, .el-tabs__content,
.ba-scroll-style { .ba-scroll-style {
scrollbar-width: none; scrollbar-width: none;
&::-webkit-scrollbar { &::-webkit-scrollbar {
width: 5px; width: 5px;
height: 5px; height: 5px;
} }
&::-webkit-scrollbar-thumb { &::-webkit-scrollbar-thumb {
background: #eaeaea; background: #eaeaea;
border-radius: var(--el-border-radius-base); border-radius: var(--el-border-radius-base);
box-shadow: none; box-shadow: none;
-webkit-box-shadow: none; -webkit-box-shadow: none;
} cursor: pointer !important;
}
&:hover {
&::-webkit-scrollbar-thumb:hover { &:hover {
background: #c8c9cc; &::-webkit-scrollbar-thumb:hover {
} background: #c8c9cc;
} }
} }
}
/* dialog滚动条-e */
/* dialog滚动条-e */
/* 小屏设备 el-radio-group 样式优化-s */
.ba-input-item-radio { /* 小屏设备 el-radio-group 样式优化-s */
margin-bottom: 10px; .ba-input-item-radio {
margin-bottom: 10px;
.el-radio-group {
.el-radio { .el-radio-group {
margin-bottom: 8px; .el-radio {
} margin-bottom: 8px;
} }
} }
}
/* 小屏设备 el-radio-group 样式调整-e */
/* 小屏设备 el-radio-group 样式调整-e */
.el-tabs--card > .el-tabs__header .el-tabs__item.is-active {
background: var(--el-color-primary); .el-tabs--card > .el-tabs__header .el-tabs__item.is-active {
color: var(--el-color-white); background: var(--el-color-primary);
} color: var(--el-color-white);
}
.el-tabs__header {
margin-bottom: 0; .el-tabs__header {
} margin-bottom: 0;
}
.el-form--inline .el-form-item {
margin-bottom: 10px; .el-form--inline .el-form-item {
} margin-bottom: 10px;
}
.el-tabs--border-card > .el-tabs__content {
padding: 10px; .el-tabs--border-card > .el-tabs__content {
} padding: 10px;
}
.el-page-header__header {
line-height: 32px; .el-page-header__header {
.el-page-header__content { line-height: 32px;
font-size: 14px; .el-page-header__content {
font-weight: 700; font-size: 14px;
} font-weight: 700;
} }
}
.el-tabs__content {
height: calc(100% - 40px); .el-tabs__content {
.el-tab-pane { height: calc(100% - 40px);
height: 100%; .el-tab-pane {
} height: 100%;
} }
}
.el-button--primary:focus {
color: var(--el-color-white); .el-button--primary:focus {
// border-color: var(--el-color-primary); color: var(--el-color-white);
// background-color: var(--el-color-primary); // border-color: var(--el-color-primary);
outline: 0; // background-color: var(--el-color-primary);
} outline: 0;
.el-button--primary:hover { }
color: var(--el-color-white); .el-button--primary:hover {
border-color: var(--el-color-primary-light-3); color: var(--el-color-white);
background-color: var(--el-color-primary-light-3); border-color: var(--el-color-primary-light-3);
outline: 0; background-color: var(--el-color-primary-light-3);
} outline: 0;
.el-button.is-plain:focus { }
color: var(--el-button-text-color); .el-button.is-plain:focus {
border-color: var(--el-button-border-color); color: var(--el-button-text-color);
} border-color: var(--el-button-border-color);
.el-button.is-plain:hover { }
color: var(--el-color-primary); .el-button.is-plain:hover {
border-color: var(--el-color-primary); color: var(--el-color-primary);
} border-color: var(--el-color-primary);
.el-button.is-link:focus { }
color: var(--el-button-text-color); .el-button.is-link:focus {
} color: var(--el-button-text-color);
.el-button.is-link:hover { }
color: var(--el-button-hover-link-text-color); .el-button.is-link:hover {
} color: var(--el-button-hover-link-text-color);
.el-button--primary.is-link:hover, }
.el-button--primary.is-plain:hover, .el-button--primary.is-link:hover,
.el-button--primary.is-text:hover { .el-button--primary.is-plain:hover,
color: var(--el-color-primary-light-5); .el-button--primary.is-text:hover {
background-color: var(--el-color-primary-light-9) !important; color: var(--el-color-primary-light-5);
} background-color: var(--el-color-primary-light-9) !important;
}
.el-divider--horizontal {
margin: 15px 0; .el-divider--horizontal {
} margin: 15px 0;
.el-step__title { }
cursor: pointer; .el-step__title {
} cursor: pointer;
}
.el-checkbox__input.is-disabled.is-checked .el-checkbox__inner,
.el-radio__input.is-disabled.is-checked .el-radio__inner { .el-checkbox__input.is-disabled.is-checked .el-checkbox__inner,
background-color: var(--el-color-primary); .el-radio__input.is-disabled.is-checked .el-radio__inner {
opacity: 0.6; background-color: var(--el-color-primary);
} opacity: 0.6;
}
.sgmap-ctrl-bottom-left {
display: none !important; .sgmap-ctrl-bottom-left {
} display: none !important;
}
.el-drawer__header {
margin-bottom: 0 !important; .el-drawer__header {
} margin-bottom: 0 !important;
//tabs 添加icon样式 }
.custom-tabs-label { //tabs 添加icon样式
display: flex; .custom-tabs-label {
align-items: center; display: flex;
justify-content: space-between; align-items: center;
.el-icon { justify-content: space-between;
margin-right: 5px; .el-icon {
} margin-right: 5px;
} }
.el-pagination__sizes { }
.el-select { .el-pagination__sizes {
min-width: 128px; .el-select {
} min-width: 128px;
} }
}
.el-collapse-item__content{
padding-bottom: 0; .el-collapse-item__content{
} padding-bottom: 0;
}
//解决打开dialog body容器宽度变为 calc(100% - 8px)问题
.el-popup-parent--hidden{ //解决打开dialog body容器宽度变为 calc(100% - 8px)问题
width: 100% !important; .el-popup-parent--hidden{
width: 100% !important;
} }

4043
src/styles/mixins.css Normal file

File diff suppressed because it is too large Load Diff

1
src/styles/mixins.min.css vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -1,65 +1,71 @@
@mixin set-css-var-value($name, $value) { @mixin set-css-var-value($name, $value) {
#{joinVarName($name)}: #{$value}; #{joinVarName($name)}: #{$value};
} }
@function joinVarName($list) { @function joinVarName($list) {
$name: '--ba'; $name: '--ba';
@each $item in $list { @each $item in $list {
@if $item != '' { @if $item != '' {
$name: $name + '-' + $item; $name: $name + '-' + $item;
} }
} }
@return $name; @return $name;
} }
@function getCssVarName($args...) { @function getCssVarName($args...) {
@return joinVarName($args); @return joinVarName($args);
} }
/* /*
* 通过映射设置所有的CSS变量 * 通过映射设置所有的CSS变量
*/ */
@mixin set-component-css-var($name, $variables) { @mixin set-component-css-var($name, $variables) {
@each $attribute, $value in $variables { @each $attribute, $value in $variables {
@if $attribute == 'default' { @if $attribute == 'default' {
#{getCssVarName($name)}: #{$value}; #{getCssVarName($name)}: #{$value};
} @else { } @else {
#{getCssVarName($name, $attribute)}: #{$value}; #{getCssVarName($name, $attribute)}: #{$value};
} }
} }
} }
// mt0,mr0,mb0,ml0 --> mt100,mr100,mb100,ml100 // mt0,mr0,mb0,ml0 --> mt100,mr100,mb100,ml100
@for $i from 0 through 100 { @for $i from 0 through 100 {
.mt#{$i} { .md#{$i} {
margin-top: #{$i}px !important; margin: #{$i}px !important;
} }
.mt#{$i} {
.mr#{$i} { margin-top: #{$i}px !important;
margin-right: #{$i}px !important; }
}
.mr#{$i} {
.mb#{$i} { margin-right: #{$i}px !important;
margin-bottom: #{$i}px !important; }
}
.mb#{$i} {
.ml#{$i} { margin-bottom: #{$i}px !important;
margin-left: #{$i}px !important; }
}
.ml#{$i} {
.pt#{$i} { margin-left: #{$i}px !important;
padding-top: #{$i}px !important; }
}
.pd#{$i} {
.pr#{$i} { padding: #{$i}px !important;
padding-right: #{$i}px !important; }
} .pt#{$i} {
padding-top: #{$i}px !important;
.pb#{$i} { }
padding-bottom: #{$i}px !important;
} .pr#{$i} {
padding-right: #{$i}px !important;
.pl#{$i} { }
padding-left: #{$i}px !important;
} .pb#{$i} {
} padding-bottom: #{$i}px !important;
}
.pl#{$i} {
padding-left: #{$i}px !important;
}
}

View File

@@ -1,332 +1,363 @@
import dayjs from 'dayjs' import dayjs from 'dayjs'
import type { TableColumnCtx } from 'element-plus' import type { TableColumnCtx } from 'element-plus'
/** /**
* 日期快捷选项适用于 el-date-picker * 日期快捷选项适用于 el-date-picker
*/ */
export const defaultShortcuts = [ export const defaultShortcuts = [
{ {
text: '今天', text: '今天',
value: () => { value: () => {
return new Date() return new Date()
} }
}, },
{ {
text: '昨天', text: '昨天',
value: () => { value: () => {
const date = new Date() const date = new Date()
date.setTime(date.getTime() - 3600 * 1000 * 24) date.setTime(date.getTime() - 3600 * 1000 * 24)
return [date, date] return [date, date]
} }
}, },
{ {
text: '最近七天', text: '最近七天',
value: () => { value: () => {
const date = new Date() const date = new Date()
date.setTime(date.getTime() - 3600 * 1000 * 24 * 7) date.setTime(date.getTime() - 3600 * 1000 * 24 * 7)
return [date, new Date()] return [date, new Date()]
} }
}, },
{ {
text: '最近 30 天', text: '最近 30 天',
value: () => { value: () => {
const date = new Date() const date = new Date()
date.setTime(date.getTime() - 3600 * 1000 * 24 * 30) date.setTime(date.getTime() - 3600 * 1000 * 24 * 30)
return [date, new Date()] return [date, new Date()]
} }
}, },
{ {
text: '本月', text: '本月',
value: () => { value: () => {
const date = new Date() const date = new Date()
date.setDate(1) // 设置为当前月的第一天 date.setDate(1) // 设置为当前月的第一天
return [date, new Date()] return [date, new Date()]
} }
}, },
{ {
text: '今年', text: '今年',
value: () => { value: () => {
const date = new Date() const date = new Date()
return [new Date(`${date.getFullYear()}-01-01`), date] return [new Date(`${date.getFullYear()}-01-01`), date]
} }
} }
] ]
/** /**
* 时间日期转换 * 时间日期转换
* @param date 当前时间new Date() 格式 * @param date 当前时间new Date() 格式
* @param format 需要转换的时间格式字符串 * @param format 需要转换的时间格式字符串
* @description format 字符串随意,如 `YYYY-mm、YYYY-mm-dd` * @description format 字符串随意,如 `YYYY-mm、YYYY-mm-dd`
* @description format 季度:"YYYY-mm-dd HH:MM:SS QQQQ" * @description format 季度:"YYYY-mm-dd HH:MM:SS QQQQ"
* @description format 星期:"YYYY-mm-dd HH:MM:SS WWW" * @description format 星期:"YYYY-mm-dd HH:MM:SS WWW"
* @description format 几周:"YYYY-mm-dd HH:MM:SS ZZZ" * @description format 几周:"YYYY-mm-dd HH:MM:SS ZZZ"
* @description format 季度 + 星期 + 几周:"YYYY-mm-dd HH:MM:SS WWW QQQQ ZZZ" * @description format 季度 + 星期 + 几周:"YYYY-mm-dd HH:MM:SS WWW QQQQ ZZZ"
* @returns 返回拼接后的时间字符串 * @returns 返回拼接后的时间字符串
*/ */
export function formatDate(date: Date, format?: string): string { export function formatDate(date: Date, format?: string): string {
// 日期不存在,则返回空 // 日期不存在,则返回空
if (!date) { if (!date) {
return '' return ''
} }
// 日期存在,则进行格式化 // 日期存在,则进行格式化
return date ? dayjs(date).format(format ?? 'YYYY-MM-DD HH:mm:ss') : '' return date ? dayjs(date).format(format ?? 'YYYY-MM-DD HH:mm:ss') : ''
} }
/** /**
* 获取当前的日期+时间 * 获取当前的日期+时间
*/ */
export function getNowDateTime() { export function getNowDateTime() {
return dayjs() return dayjs()
} }
/** /**
* 获取当前日期是第几周 * 获取当前日期是第几周
* @param dateTime 当前传入的日期值 * @param dateTime 当前传入的日期值
* @returns 返回第几周数字值 * @returns 返回第几周数字值
*/ */
export function getWeek(dateTime: Date): number { export function getWeek(dateTime: Date): number {
const temptTime = new Date(dateTime.getTime()) const temptTime = new Date(dateTime.getTime())
// 周几 // 周几
const weekday = temptTime.getDay() || 7 const weekday = temptTime.getDay() || 7
// 周1+5天=周六 // 周1+5天=周六
temptTime.setDate(temptTime.getDate() - weekday + 1 + 5) temptTime.setDate(temptTime.getDate() - weekday + 1 + 5)
let firstDay = new Date(temptTime.getFullYear(), 0, 1) let firstDay = new Date(temptTime.getFullYear(), 0, 1)
const dayOfWeek = firstDay.getDay() const dayOfWeek = firstDay.getDay()
let spendDay = 1 let spendDay = 1
if (dayOfWeek != 0) spendDay = 7 - dayOfWeek + 1 if (dayOfWeek != 0) spendDay = 7 - dayOfWeek + 1
firstDay = new Date(temptTime.getFullYear(), 0, 1 + spendDay) firstDay = new Date(temptTime.getFullYear(), 0, 1 + spendDay)
const d = Math.ceil((temptTime.valueOf() - firstDay.valueOf()) / 86400000) const d = Math.ceil((temptTime.valueOf() - firstDay.valueOf()) / 86400000)
return Math.ceil(d / 7) return Math.ceil(d / 7)
} }
/** /**
* 将时间转换为 `几秒前`、`几分钟前`、`几小时前`、`几天前` * 将时间转换为 `几秒前`、`几分钟前`、`几小时前`、`几天前`
* @param param 当前时间new Date() 格式或者字符串时间格式 * @param param 当前时间new Date() 格式或者字符串时间格式
* @param format 需要转换的时间格式字符串 * @param format 需要转换的时间格式字符串
* @description param 10秒 10 * 1000 * @description param 10秒 10 * 1000
* @description param 1分 60 * 1000 * @description param 1分 60 * 1000
* @description param 1小时 60 * 60 * 1000 * @description param 1小时 60 * 60 * 1000
* @description param 24小时60 * 60 * 24 * 1000 * @description param 24小时60 * 60 * 24 * 1000
* @description param 3天 60 * 60* 24 * 1000 * 3 * @description param 3天 60 * 60* 24 * 1000 * 3
* @returns 返回拼接后的时间字符串 * @returns 返回拼接后的时间字符串
*/ */
export function formatPast(param: string | Date, format = 'YYYY-mm-dd HH:MM:SS'): string { export function formatPast(param: string | Date, format = 'YYYY-mm-dd HH:MM:SS'): string {
// 传入格式处理、存储转换值 // 传入格式处理、存储转换值
let t: any, s: number let t: any, s: number
// 获取js 时间戳 // 获取js 时间戳
let time: number = new Date().getTime() let time: number = new Date().getTime()
// 是否是对象 // 是否是对象
typeof param === 'string' || 'object' ? (t = new Date(param).getTime()) : (t = param) typeof param === 'string' || 'object' ? (t = new Date(param).getTime()) : (t = param)
// 当前时间戳 - 传入时间戳 // 当前时间戳 - 传入时间戳
time = Number.parseInt(`${time - t}`) time = Number.parseInt(`${time - t}`)
if (time < 10000) { if (time < 10000) {
// 10秒内 // 10秒内
return '刚刚' return '刚刚'
} else if (time < 60000 && time >= 10000) { } else if (time < 60000 && time >= 10000) {
// 超过10秒少于1分钟内 // 超过10秒少于1分钟内
s = Math.floor(time / 1000) s = Math.floor(time / 1000)
return `${s}秒前` return `${s}秒前`
} else if (time < 3600000 && time >= 60000) { } else if (time < 3600000 && time >= 60000) {
// 超过1分钟少于1小时 // 超过1分钟少于1小时
s = Math.floor(time / 60000) s = Math.floor(time / 60000)
return `${s}分钟前` return `${s}分钟前`
} else if (time < 86400000 && time >= 3600000) { } else if (time < 86400000 && time >= 3600000) {
// 超过1小时少于24小时 // 超过1小时少于24小时
s = Math.floor(time / 3600000) s = Math.floor(time / 3600000)
return `${s}小时前` return `${s}小时前`
} else if (time < 259200000 && time >= 86400000) { } else if (time < 259200000 && time >= 86400000) {
// 超过1天少于3天内 // 超过1天少于3天内
s = Math.floor(time / 86400000) s = Math.floor(time / 86400000)
return `${s}天前` return `${s}天前`
} else { } else {
// 超过3天 // 超过3天
const date = typeof param === 'string' || 'object' ? new Date(param) : param const date = typeof param === 'string' || 'object' ? new Date(param) : param
return formatDate(date, format) return formatDate(date, format)
} }
} }
/** /**
* 时间问候语 * 时间问候语
* @param param 当前时间new Date() 格式 * @param param 当前时间new Date() 格式
* @description param 调用 `formatAxis(new Date())` 输出 `上午好` * @description param 调用 `formatAxis(new Date())` 输出 `上午好`
* @returns 返回拼接后的时间字符串 * @returns 返回拼接后的时间字符串
*/ */
export function formatAxis(param: Date): string { export function formatAxis(param: Date): string {
const hour: number = new Date(param).getHours() const hour: number = new Date(param).getHours()
if (hour < 6) return '凌晨好' if (hour < 6) return '凌晨好'
else if (hour < 9) return '早上好' else if (hour < 9) return '早上好'
else if (hour < 12) return '上午好' else if (hour < 12) return '上午好'
else if (hour < 14) return '中午好' else if (hour < 14) return '中午好'
else if (hour < 17) return '下午好' else if (hour < 17) return '下午好'
else if (hour < 19) return '傍晚好' else if (hour < 19) return '傍晚好'
else if (hour < 22) return '晚上好' else if (hour < 22) return '晚上好'
else return '夜里好' else return '夜里好'
} }
/** /**
* 将毫秒转换成时间字符串。例如说xx 分钟 * 将毫秒转换成时间字符串。例如说xx 分钟
* *
* @param ms 毫秒 * @param ms 毫秒
* @returns {string} 字符串 * @returns {string} 字符串
*/ */
export function formatPast2(ms: number): string { export function formatPast2(ms: number): string {
const day = Math.floor(ms / (24 * 60 * 60 * 1000)) const day = Math.floor(ms / (24 * 60 * 60 * 1000))
const hour = Math.floor(ms / (60 * 60 * 1000) - day * 24) const hour = Math.floor(ms / (60 * 60 * 1000) - day * 24)
const minute = Math.floor(ms / (60 * 1000) - day * 24 * 60 - hour * 60) const minute = Math.floor(ms / (60 * 1000) - day * 24 * 60 - hour * 60)
const second = Math.floor(ms / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - minute * 60) const second = Math.floor(ms / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - minute * 60)
if (day > 0) { if (day > 0) {
return day + ' 天' + hour + ' 小时 ' + minute + ' 分钟' return day + ' 天' + hour + ' 小时 ' + minute + ' 分钟'
} }
if (hour > 0) { if (hour > 0) {
return hour + ' 小时 ' + minute + ' 分钟' return hour + ' 小时 ' + minute + ' 分钟'
} }
if (minute > 0) { if (minute > 0) {
return minute + ' 分钟' return minute + ' 分钟'
} }
if (second > 0) { if (second > 0) {
return second + ' 秒' return second + ' 秒'
} else { } else {
return 0 + ' 秒' return 0 + ' 秒'
} }
} }
/** /**
* element plus 的时间 Formatter 实现,使用 YYYY-MM-DD HH:mm:ss 格式 * element plus 的时间 Formatter 实现,使用 YYYY-MM-DD HH:mm:ss 格式
* *
* @param row 行数据 * @param row 行数据
* @param column 字段 * @param column 字段
* @param cellValue 字段值 * @param cellValue 字段值
*/ */
export function dateFormatter(_row: any, _column: TableColumnCtx<any>, cellValue: any): string { export function dateFormatter(_row: any, _column: TableColumnCtx<any>, cellValue: any): string {
return cellValue ? formatDate(cellValue) : '' return cellValue ? formatDate(cellValue) : ''
} }
/** /**
* element plus 的时间 Formatter 实现,使用 YYYY-MM-DD 格式 * element plus 的时间 Formatter 实现,使用 YYYY-MM-DD 格式
* *
* @param row 行数据 * @param row 行数据
* @param column 字段 * @param column 字段
* @param cellValue 字段值 * @param cellValue 字段值
*/ */
export function dateFormatter2(_row: any, _column: TableColumnCtx<any>, cellValue: any): string { export function dateFormatter2(_row: any, _column: TableColumnCtx<any>, cellValue: any): string {
return cellValue ? formatDate(cellValue, 'YYYY-MM-DD') : '' return cellValue ? formatDate(cellValue, 'YYYY-MM-DD') : ''
} }
/** /**
* 设置起始日期时间为00:00:00 * 设置起始日期时间为00:00:00
* @param param 传入日期 * @param param 传入日期
* @returns 带时间00:00:00的日期 * @returns 带时间00:00:00的日期
*/ */
export function beginOfDay(param: Date): Date { export function beginOfDay(param: Date): Date {
return new Date(param.getFullYear(), param.getMonth(), param.getDate(), 0, 0, 0) return new Date(param.getFullYear(), param.getMonth(), param.getDate(), 0, 0, 0)
} }
/** /**
* 设置结束日期时间为23:59:59 * 设置结束日期时间为23:59:59
* @param param 传入日期 * @param param 传入日期
* @returns 带时间23:59:59的日期 * @returns 带时间23:59:59的日期
*/ */
export function endOfDay(param: Date): Date { export function endOfDay(param: Date): Date {
return new Date(param.getFullYear(), param.getMonth(), param.getDate(), 23, 59, 59) return new Date(param.getFullYear(), param.getMonth(), param.getDate(), 23, 59, 59)
} }
/** /**
* 计算两个日期间隔天数 * 计算两个日期间隔天数
* @param param1 日期1 * @param param1 日期1
* @param param2 日期2 * @param param2 日期2
*/ */
export function betweenDay(param1: Date, param2: Date): number { export function betweenDay(param1: Date, param2: Date): number {
param1 = convertDate(param1) param1 = convertDate(param1)
param2 = convertDate(param2) param2 = convertDate(param2)
// 计算差值 // 计算差值
return Math.floor((param2.getTime() - param1.getTime()) / (24 * 3600 * 1000)) return Math.floor((param2.getTime() - param1.getTime()) / (24 * 3600 * 1000))
} }
/** /**
* 日期计算 * 日期计算
* @param param1 日期 * @param param1 日期
* @param param2 添加的时间 * @param param2 添加的时间
*/ */
export function addTime(param1: Date, param2: number): Date { export function addTime(param1: Date, param2: number): Date {
param1 = convertDate(param1) param1 = convertDate(param1)
return new Date(param1.getTime() + param2) return new Date(param1.getTime() + param2)
} }
/** /**
* 日期转换 * 日期转换
* @param param 日期 * @param param 日期
*/ */
export function convertDate(param: Date | string): Date { export function convertDate(param: Date | string): Date {
if (typeof param === 'string') { if (typeof param === 'string') {
return new Date(param) return new Date(param)
} }
return param return param
} }
/** /**
* 指定的两个日期, 是否为同一天 * 指定的两个日期, 是否为同一天
* @param a 日期 A * @param a 日期 A
* @param b 日期 B * @param b 日期 B
*/ */
export function isSameDay(a: dayjs.ConfigType, b: dayjs.ConfigType): boolean { export function isSameDay(a: dayjs.ConfigType, b: dayjs.ConfigType): boolean {
if (!a || !b) return false if (!a || !b) return false
const aa = dayjs(a) const aa = dayjs(a)
const bb = dayjs(b) const bb = dayjs(b)
return aa.year() == bb.year() && aa.month() == bb.month() && aa.day() == bb.day() return aa.year() == bb.year() && aa.month() == bb.month() && aa.day() == bb.day()
} }
/** /**
* 获取一天的开始时间、截止时间 * 获取一天的开始时间、截止时间
* @param date 日期 * @param date 日期
* @param days 天数 * @param days 天数
*/ */
export function getDayRange( export function getDayRange(date: dayjs.ConfigType, days: number): [dayjs.ConfigType, dayjs.ConfigType] {
date: dayjs.ConfigType, const day = dayjs(date).add(days, 'd')
days: number return getDateRange(day, day)
): [dayjs.ConfigType, dayjs.ConfigType] { }
const day = dayjs(date).add(days, 'd')
return getDateRange(day, day) /**
} * 获取最近7天的开始时间、截止时间
*/
/** export function getLast7Days(): [dayjs.ConfigType, dayjs.ConfigType] {
* 获取最近7天的开始时间、截止时间 const lastWeekDay = dayjs().subtract(7, 'd')
*/ const yesterday = dayjs().subtract(1, 'd')
export function getLast7Days(): [dayjs.ConfigType, dayjs.ConfigType] { return getDateRange(lastWeekDay, yesterday)
const lastWeekDay = dayjs().subtract(7, 'd') }
const yesterday = dayjs().subtract(1, 'd')
return getDateRange(lastWeekDay, yesterday) /**
} * 获取最近30天的开始时间、截止时间
*/
/** export function getLast30Days(): [dayjs.ConfigType, dayjs.ConfigType] {
* 获取最近30天的开始时间、截止时间 const lastMonthDay = dayjs().subtract(30, 'd')
*/ const yesterday = dayjs().subtract(1, 'd')
export function getLast30Days(): [dayjs.ConfigType, dayjs.ConfigType] { return getDateRange(lastMonthDay, yesterday)
const lastMonthDay = dayjs().subtract(30, 'd') }
const yesterday = dayjs().subtract(1, 'd')
return getDateRange(lastMonthDay, yesterday) /**
} * 获取最近1年的开始时间、截止时间
*/
/** export function getLast1Year(): [dayjs.ConfigType, dayjs.ConfigType] {
* 获取最近1年的开始时间、截止时间 const lastYearDay = dayjs().subtract(1, 'y')
*/ const yesterday = dayjs().subtract(1, 'd')
export function getLast1Year(): [dayjs.ConfigType, dayjs.ConfigType] { return getDateRange(lastYearDay, yesterday)
const lastYearDay = dayjs().subtract(1, 'y') }
const yesterday = dayjs().subtract(1, 'd')
return getDateRange(lastYearDay, yesterday) /**
} * 获取指定日期的开始时间、截止时间
* @param beginDate 开始日期
/** * @param endDate 截止日期
* 获取指定日期的开始时间、截止时间 */
* @param beginDate 开始日期 export function getDateRange(beginDate: dayjs.ConfigType, endDate: dayjs.ConfigType): [string, string] {
* @param endDate 截止日期 return [
*/ dayjs(beginDate).startOf('d').format('YYYY-MM-DD HH:mm:ss'),
export function getDateRange( dayjs(endDate).endOf('d').format('YYYY-MM-DD HH:mm:ss')
beginDate: dayjs.ConfigType, ]
endDate: dayjs.ConfigType }
): [string, string] { /**
return [ * 获取当月时间
dayjs(beginDate).startOf('d').format('YYYY-MM-DD HH:mm:ss'), * @param beginDate 开始日期
dayjs(endDate).endOf('d').format('YYYY-MM-DD HH:mm:ss') * @param endDate 截止日期
] * @param key 1:年 2:季 3:月 4:周 5:日
} */
export function getTimeOfTheMonth(key: any): [string, string] {
const now = new Date()
const year = now.getFullYear()
const month = now.getMonth()
switch (key) {
case '1': // 年
return [formatDate(new Date(year, 0, 1), 'YYYY-MM-DD'), formatDate(now, 'YYYY-MM-DD')]
case '2': // 季
const quarterStartMonth = Math.floor(month / 3) * 3
const quarterEndMonth = quarterStartMonth + 2
return [formatDate(new Date(year, quarterStartMonth, 1), 'YYYY-MM-DD'), formatDate(now, 'YYYY-MM-DD')]
case '3': // 月
return [formatDate(new Date(year, month, 1), 'YYYY-MM-DD'), formatDate(now, 'YYYY-MM-DD')]
case '4': // 周
const dayOfWeek = now.getDay() // 0是周日
const diff = now.getDate() - dayOfWeek + (dayOfWeek === 0 ? -6 : 1) // 调整为周一
const weekStart = new Date(year, month, diff)
return [formatDate(weekStart, 'YYYY-MM-DD'), formatDate(now, 'YYYY-MM-DD')]
case '5': // 日
return [formatDate(now, 'YYYY-MM-DD'), formatDate(now, 'YYYY-MM-DD')]
default:
throw new Error('Invalid key')
}
}

View File

@@ -1,216 +1,216 @@
import { reactive } from 'vue' import { reactive } from 'vue'
import createAxios from '@/utils/request' import createAxios from '@/utils/request'
import { requestPayload } from '@/utils/request' import { requestPayload } from '@/utils/request'
import { Method } from 'axios' import { Method } from 'axios'
import { mainHeight } from '@/utils/layout' import { mainHeight } from '@/utils/layout'
import { filtration } from './tableMethod' import { filtration } from './tableMethod'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
interface TableStoreParams { interface TableStoreParams {
url: string // 请求地址 url: string // 请求地址
pk?: string pk?: string
column: TableColumn[] column: TableColumn[]
params?: anyObj params?: anyObj
exportName?: any // 导出文件名 exportName?: any // 导出文件名
method?: Method // 请求方式 method?: Method // 请求方式
isWebPaging?: boolean // 是否前端分页 isWebPaging?: boolean // 是否前端分页
showPage?: boolean //是否需要分页 showPage?: boolean //是否需要分页
paramsPOST?: boolean // post请求 params传参 paramsPOST?: boolean // post请求 params传参
publicHeight?: number //计算高度 publicHeight?: number //计算高度
resetCallback?: () => void // 重置 resetCallback?: () => void // 重置
loadCallback?: () => void // 接口调用后的回调 loadCallback?: () => void // 接口调用后的回调
beforeSearchFun?: () => void // 接口调用前的回调 beforeSearchFun?: () => void // 接口调用前的回调
} }
export default class TableStore { export default class TableStore {
public url public url
public pk public pk
public method: Method public method: Method
public initData: any = null public initData: any = null
public exportName: any = null public exportName: any = null
public isWebPaging = false public isWebPaging = false
public paramsPOST = true public paramsPOST = true
public showPage = true public showPage = true
public table: CnTable = reactive({ public table: CnTable = reactive({
ref: null, ref: null,
selection: [], selection: [],
data: [], data: [],
copyData: [], copyData: [],
allData: [], allData: [],
allFlag: false, allFlag: false,
webPagingData: [], webPagingData: [],
total: 0, total: 0,
params: { params: {
pageNum: 1, pageNum: 1,
pageSize: 20 pageSize: 20
}, },
loading: true, loading: true,
column: [], column: [],
loadCallback: null, loadCallback: null,
resetCallback: null, resetCallback: null,
beforeSearchFun: null, beforeSearchFun: null,
height: '', height: '',
publicHeight: 0 publicHeight: 0
}) })
constructor(public options: TableStoreParams) { constructor(public options: TableStoreParams) {
this.url = options.url this.url = options.url
this.pk = options.pk || 'id' this.pk = options.pk || 'id'
this.paramsPOST = options.paramsPOST || false this.paramsPOST = options.paramsPOST || false
this.isWebPaging = options.isWebPaging || false this.isWebPaging = options.isWebPaging || false
this.exportName = options.exportName || null this.exportName = options.exportName || null
this.method = options.method || 'GET' this.method = options.method || 'GET'
this.table.column = options.column this.table.column = options.column
this.showPage = options.showPage !== false this.showPage = options.showPage !== false
this.table.publicHeight = options.publicHeight || 0 this.table.publicHeight = options.publicHeight || 0
this.table.resetCallback = options.resetCallback || null this.table.resetCallback = options.resetCallback || null
this.table.loadCallback = options.loadCallback || null this.table.loadCallback = options.loadCallback || null
this.table.beforeSearchFun = options.beforeSearchFun || null this.table.beforeSearchFun = options.beforeSearchFun || null
Object.assign(this.table.params, options.params) Object.assign(this.table.params, options.params)
this.table.height = mainHeight(20 + (this.showPage ? 58 : 0) + this.table.publicHeight).height as string this.table.height = mainHeight(20 + (this.showPage ? 58 : 0) + this.table.publicHeight).height as string
} }
index() { index() {
this.table.beforeSearchFun && this.table.beforeSearchFun() this.table.beforeSearchFun && this.table.beforeSearchFun()
this.table.data = [] this.table.data = []
this.table.loading = true this.table.loading = true
// 重置用的数据数据 // 重置用的数据数据
if (!this.initData) { if (!this.initData) {
this.initData = JSON.parse(JSON.stringify(this.table.params)) this.initData = JSON.parse(JSON.stringify(this.table.params))
} }
createAxios( createAxios(
Object.assign( Object.assign(
{ {
url: this.url, url: this.url,
method: this.method method: this.method
}, },
requestPayload(this.method, this.table.params, this.paramsPOST) requestPayload(this.method, this.table.params, this.paramsPOST)
) )
) )
.then((res: any) => { .then((res: any) => {
if (res.data) { if (res.data) {
this.table.data = res.data.records || res.data this.table.data = res.data.records || res.data
this.table.total = res.data?.total || res.data.length || 0 this.table.total = res.data?.total || res.data.length || 0
} else { } else {
this.table.data = [] this.table.data = []
this.table.total = 0 this.table.total = 0
} }
this.table.copyData = filtration(this.table.data) this.table.copyData = filtration(this.table.data)
if (Array.isArray(res)) { if (Array.isArray(res)) {
this.table.data = res this.table.data = res
} }
if (this.isWebPaging) { if (this.isWebPaging) {
this.table.webPagingData = window.XEUtils.chunk(this.table.data, this.table.params.pageSize) this.table.webPagingData = window.XEUtils.chunk(this.table.data, this.table.params.pageSize)
this.table.data = this.table.webPagingData[this.table.params.pageNum - 1] this.table.data = this.table.webPagingData[this.table.params.pageNum - 1]
} }
this.table.loadCallback && this.table.loadCallback() this.table.loadCallback && this.table.loadCallback()
this.table.loading = false this.table.loading = false
}) })
.catch(() => { .catch(() => {
this.table.loading = false this.table.loading = false
}) })
} }
/** /**
* 表格内的事件统一响应 * 表格内的事件统一响应
* @param event 事件:selection-change=选中项改变,page-size-change=每页数量改变,current-page-change=翻页 * @param event 事件:selection-change=选中项改变,page-size-change=每页数量改变,current-page-change=翻页
* @param data 携带数据 * @param data 携带数据
*/ */
onTableAction = (event: string, data: anyObj) => { onTableAction = (event: string, data: anyObj) => {
const actionFun = new Map([ const actionFun = new Map([
[ [
'search', 'search',
() => { () => {
this.table.params.pageNum = 1 this.table.params.pageNum = 1
this.index() this.index()
} }
], ],
[ [
'reset', 'reset',
() => { () => {
delete this.initData.pageSize delete this.initData.pageSize
// console.log(this.table.params) // console.log(this.table.params)
// console.log(this.initData) // console.log(this.initData)
Object.assign(this.table.params, this.initData) Object.assign(this.table.params, this.initData)
this.index() this.index()
this.table.resetCallback && this.table.resetCallback() this.table.resetCallback && this.table.resetCallback()
} }
], ],
[ [
'selection-change', 'selection-change',
() => { () => {
this.table.selection = data as TableRow[] this.table.selection = data as TableRow[]
} }
], ],
[ [
'page-size-change', 'page-size-change',
() => { () => {
this.table.params.pageSize = data.size this.table.params.pageSize = data.size
this.table.params.pageNum = 1 this.table.params.pageNum = 1
if (this.isWebPaging) { if (this.isWebPaging) {
this.table.webPagingData = window.XEUtils.chunk( this.table.webPagingData = window.XEUtils.chunk(
window.XEUtils.flatten(this.table.webPagingData), window.XEUtils.flatten(this.table.webPagingData),
this.table.params.pageSize this.table.params.pageSize
) )
this.table.data = this.table.webPagingData[this.table.params.pageNum - 1] this.table.data = this.table.webPagingData[this.table.params.pageNum - 1]
} else { } else {
this.index() this.index()
} }
} }
], ],
[ [
'current-page-change', 'current-page-change',
() => { () => {
this.table.params.pageNum = data.page this.table.params.pageNum = data.page
if (this.isWebPaging) { if (this.isWebPaging) {
this.table.data = [] this.table.data = []
requestAnimationFrame(() => { requestAnimationFrame(() => {
this.table.data = this.table.webPagingData[data.page - 1] this.table.data = this.table.webPagingData[data.page - 1]
}) })
} else { } else {
this.index() this.index()
} }
} }
], ],
[ [
'field-change', 'field-change',
() => { () => {
console.warn('field-change') console.warn('field-change')
} }
], ],
[ [
'default', 'default',
() => { () => {
console.warn('No action defined') console.warn('No action defined')
} }
], ],
[ [
'export', 'export',
() => { () => {
ElMessage({ ElMessage({
message: '正在导出,请稍等...', message: '正在导出,请稍等...',
type: 'info', type: 'info',
duration: 1000 duration: 1000
}) })
let params = { ...this.table.params, pageNum: 1, pageSize: this.table.total } let params = { ...this.table.params, pageNum: 1, pageSize: this.table.total }
setTimeout(() => { setTimeout(() => {
createAxios( createAxios(
Object.assign( Object.assign(
{ {
url: this.url, url: this.url,
method: this.method method: this.method
}, },
requestPayload(this.method, params, this.paramsPOST) requestPayload(this.method, params, this.paramsPOST)
) )
).then(res => { ).then(res => {
this.table.allData = filtration(res.data.records || res.data) this.table.allData = filtration(res.data.records || res.data)
this.table.allFlag = data.showAllFlag || true this.table.allFlag = data.showAllFlag || true
}) })
}, 1500) }, 1500)
} }
] ]
]) ])
const action = actionFun.get(event) || actionFun.get('default') const action = actionFun.get(event) || actionFun.get('default')
action!.call(this) action!.call(this)
} }
} }

View File

@@ -1,129 +1,129 @@
<template> <template>
<!-- 异常事件 --> <!-- 异常事件 -->
<TableHeader datePicker ref="refheader" showExport> <TableHeader datePicker ref="refheader" showExport>
<!-- <template v-slot:select> <!-- <template v-slot:select>
<el-form-item label="数据来源"> <el-form-item label="数据来源">
<el-cascader <el-cascader
placeholder="请选择数据来源" placeholder="请选择数据来源"
@change="sourceChange" @change="sourceChange"
:options="props.deviceTree" :options="props.deviceTree"
:show-all-levels="false" :show-all-levels="false"
:props="{ checkStrictly: true }" :props="{ checkStrictly: true }"
clearable clearable
></el-cascader> ></el-cascader>
</el-form-item> </el-form-item>
<el-form-item label="级别"> <el-form-item label="级别">
<el-select v-model.trim="tableStore.table.params.level" placeholder="请选择级别" clearable> <el-select v-model.trim="tableStore.table.params.level" placeholder="请选择级别" clearable>
<el-option <el-option
v-for="item in rankOptions" v-for="item in rankOptions"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</template> --> </template> -->
<template #select> <template #select>
<el-form-item label="设备名称"> <el-form-item label="设备名称">
<el-input <el-input
maxlength="32" maxlength="32"
clearable clearable
show-word-limit show-word-limit
v-model.trim="tableStore.table.params.searchValue" v-model.trim="tableStore.table.params.searchValue"
placeholder="请输入设备名称" placeholder="请输入设备名称"
/> />
</el-form-item> </el-form-item>
</template> </template>
</TableHeader> </TableHeader>
<!-- <div style="height: 300px;"> --> <!-- <div style="height: 300px;"> -->
<Table ref="tableRef" :isGroup="true" /> <Table ref="tableRef" :isGroup="true" />
<!-- </div> --> <!-- </div> -->
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, provide } from 'vue' import { ref, onMounted, provide } from 'vue'
import TableStore from '@/utils/tableStore' import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue' import Table from '@/components/table/index.vue'
import TableHeader from '@/components/table/header/index.vue' import TableHeader from '@/components/table/header/index.vue'
import { mainHeight } from '@/utils/layout' import { mainHeight } from '@/utils/layout'
const props = defineProps(['deviceTree']) const props = defineProps(['deviceTree'])
const refheader = ref() const refheader = ref()
const deviceTree = ref([]) const deviceTree = ref([])
const tabsList = ref([ const tabsList = ref([
{ {
label: '设备告警', label: '设备告警',
name: 3 name: 3
}, },
{ {
label: '稳态越限告警', label: '稳态越限告警',
name: 1 name: 1
}, },
{ {
label: '暂态事件', label: '暂态事件',
name: 0 name: 0
} }
]) ])
const rankOptions = ref([ const rankOptions = ref([
{ {
value: '1', value: '1',
label: '1级' label: '1级'
}, },
{ {
value: '2', value: '2',
label: '2级' label: '2级'
}, },
{ {
value: '3', value: '3',
label: '3级' label: '3级'
} }
]) ])
const tableStore = new TableStore({ const tableStore = new TableStore({
url: '/zl-event-boot/csDevErrEvt/list', url: '/zl-event-boot/csDevErrEvt/list',
method: 'POST', method: 'POST',
exportName: '异常事件', exportName: '异常事件',
publicHeight: 65, publicHeight: 65,
column: [ column: [
{ {
title: '序号', title: '序号',
width: 80, width: 80,
formatter: (row: any) => { formatter: (row: any) => {
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1 return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
} }
}, },
{ title: '设备名称', field: 'ndid', align: 'center' }, { title: '设备名称', field: 'ndid', align: 'center' },
{ title: '异常时间', field: 'evtTime', align: 'center', sortable: true }, { title: '异常时间', field: 'evtTime', align: 'center', sortable: true },
{ title: '告警代码', field: 'code', align: 'center', sortable: true } { title: '告警代码', field: 'code', align: 'center', sortable: true }
] ]
}) })
provide('tableStore', tableStore) provide('tableStore', tableStore)
// "target": [], // "target": [],
// "type": "", // "type": "",
// "userId": "" // "userId": ""
tableStore.table.params.engineeringid = '' tableStore.table.params.engineeringid = ''
tableStore.table.params.projectId = '' tableStore.table.params.projectId = ''
tableStore.table.params.deviceId = '' tableStore.table.params.deviceId = ''
tableStore.table.params.type = 3 tableStore.table.params.type = 3
tableStore.table.params.eventIds = [] tableStore.table.params.eventIds = []
tableStore.table.params.status = '' tableStore.table.params.status = ''
tableStore.table.params.target = [] tableStore.table.params.target = []
tableStore.table.params.userId = '' tableStore.table.params.userId = ''
tableStore.table.params.searchValue = '' tableStore.table.params.searchValue = ''
const sourceChange = (e: any) => { const sourceChange = (e: any) => {
tableStore.table.params.engineeringid = e[0] || '' tableStore.table.params.engineeringid = e[0] || ''
tableStore.table.params.projectId = e[1] || '' tableStore.table.params.projectId = e[1] || ''
tableStore.table.params.deviceId = e[2] || '' tableStore.table.params.deviceId = e[2] || ''
} }
onMounted(() => { onMounted(() => {
tableStore.index() tableStore.index()
}) })
setTimeout(() => { setTimeout(() => {
tableStore.table.height = mainHeight(200).height as any tableStore.table.height = mainHeight(200).height as any
}, 0) }, 0)
const addMenu = () => {} const addMenu = () => {}
</script> </script>
<style></style> <style></style>

View File

@@ -1,190 +1,190 @@
<template> <template>
<TableHeader datePicker ref="refheader" showExport> <TableHeader datePicker ref="refheader" showExport>
<template v-slot:select> <template v-slot:select>
<el-form-item label="数据来源"> <el-form-item label="数据来源">
<el-cascader <el-cascader
v-model.trim="tableStore.table.params.cascader" v-model.trim="tableStore.table.params.cascader"
filterable filterable
placeholder="请选择数据来源" placeholder="请选择数据来源"
@change="sourceChange" @change="sourceChange"
:options="deviceTreeOptions" :options="deviceTreeOptions"
:show-all-levels="false" :show-all-levels="false"
:props="{ checkStrictly: true }" :props="{ checkStrictly: true }"
clearable clearable
></el-cascader> ></el-cascader>
<!-- <el-input maxlength="32" show-word-limit v-model.trim="tableStore.table.params.searchValue" placeholder="请输入设备名称" /> --> <!-- <el-input maxlength="32" show-word-limit v-model.trim="tableStore.table.params.searchValue" placeholder="请输入设备名称" /> -->
</el-form-item> </el-form-item>
<el-form-item label="级别"> <el-form-item label="级别">
<el-select v-model.trim="tableStore.table.params.level" placeholder="请选择级别" clearable> <el-select v-model.trim="tableStore.table.params.level" placeholder="请选择级别" clearable>
<el-option <el-option
v-for="item in rankOptions" v-for="item in rankOptions"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</template> </template>
</TableHeader> </TableHeader>
<!-- <div style="height: 300px;"> --> <!-- <div style="height: 300px;"> -->
<Table ref="tableRef" :isGroup="true" /> <Table ref="tableRef" :isGroup="true" />
<!-- </div> --> <!-- </div> -->
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, provide } from 'vue' import { ref, onMounted, provide } from 'vue'
import TableStore from '@/utils/tableStore' import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue' import Table from '@/components/table/index.vue'
import TableHeader from '@/components/table/header/index.vue' import TableHeader from '@/components/table/header/index.vue'
import { mainHeight } from '@/utils/layout' import { mainHeight } from '@/utils/layout'
const props = defineProps(['deviceTree']) const props = defineProps(['deviceTree'])
const refheader = ref() const refheader = ref()
const deviceTree = ref([]) const deviceTree = ref([])
const tabsList = ref([ const tabsList = ref([
{ {
label: '设备告警', label: '设备告警',
name: 3 name: 3
}, },
{ {
label: '稳态越限告警', label: '稳态越限告警',
name: 1 name: 1
}, },
{ {
label: '暂态事件', label: '暂态事件',
name: 0 name: 0
} }
]) ])
const rankOptions = ref([ const rankOptions = ref([
{ {
value: '1', value: '1',
label: '1级' label: '1级'
}, },
{ {
value: '2', value: '2',
label: '2级' label: '2级'
}, },
{ {
value: '3', value: '3',
label: '3级' label: '3级'
} }
]) ])
const tableStore = new TableStore({ const tableStore = new TableStore({
url: '/cs-harmonic-boot/eventUser/queryEventpageWeb', url: '/cs-harmonic-boot/eventUser/queryEventpageWeb',
method: 'POST', method: 'POST',
exportName: '设备告警', exportName: '设备告警',
publicHeight: 65, publicHeight: 65,
column: [ column: [
{ {
title: '序号', title: '序号',
width: 80, width: 80,
formatter: (row: any) => { formatter: (row: any) => {
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1 return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
} }
}, },
{ title: '设备名称', field: 'equipmentName', align: 'center' }, { title: '设备名称', field: 'equipmentName', align: 'center' },
{ title: '工程名称', field: 'engineeringName', align: 'center' }, { title: '工程名称', field: 'engineeringName', align: 'center' },
{ title: '项目名称', field: 'projectName', align: 'center' }, { title: '项目名称', field: 'projectName', align: 'center' },
{ title: '发生时刻', field: 'startTime', align: 'center', minWidth: 110, sortable: true }, { title: '发生时刻', field: 'startTime', align: 'center', minWidth: 110, sortable: true },
{ {
title: '模块信息', title: '模块信息',
field: 'moduleNo', field: 'moduleNo',
align: 'center', align: 'center',
formatter: (row: any) => { formatter: (row: any) => {
return row.cellValue ? row.cellValue : '/' return row.cellValue ? row.cellValue : '/'
} }
}, },
{ {
title: '告警代码', title: '告警代码',
field: 'code', field: 'code',
align: 'center', align: 'center',
formatter: (row: any) => { formatter: (row: any) => {
return row.cellValue ? row.cellValue : '/' return row.cellValue ? row.cellValue : '/'
}, },
sortable: true sortable: true
}, },
{ {
title: '事件描述', title: '事件描述',
field: 'showName' field: 'showName'
}, },
{ {
title: '级别', title: '级别',
field: 'level', field: 'level',
render: 'tag', render: 'tag',
custom: { custom: {
1: 'danger', 1: 'danger',
2: 'warning', 2: 'warning',
3: 'success' 3: 'success'
}, },
replaceValue: { replaceValue: {
1: '1级', 1: '1级',
2: '2级', 2: '2级',
3: '3级' 3: '3级'
} }
} }
// { // {
// title: '级别', // title: '级别',
// field: 'level', // field: 'level',
// formatter: (row: any) => { // formatter: (row: any) => {
// return row.cellValue == 1 ? '1级' : row.cellValue == 2 ? '2级' : row.cellValue == 3 ? '3级' : '/' // return row.cellValue == 1 ? '1级' : row.cellValue == 2 ? '2级' : row.cellValue == 3 ? '3级' : '/'
// } // }
// } // }
], ],
beforeSearchFun: () => {} beforeSearchFun: () => {}
}) })
provide('tableStore', tableStore) provide('tableStore', tableStore)
// "target": [], // "target": [],
// "type": "", // "type": "",
// "userId": "" // "userId": ""
tableStore.table.params.cascader = '' tableStore.table.params.cascader = ''
tableStore.table.params.level = '' tableStore.table.params.level = ''
tableStore.table.params.engineeringid = '' tableStore.table.params.engineeringid = ''
tableStore.table.params.projectId = '' tableStore.table.params.projectId = ''
tableStore.table.params.deviceId = '' tableStore.table.params.deviceId = ''
tableStore.table.params.type = 3 tableStore.table.params.type = 3
tableStore.table.params.eventIds = [] tableStore.table.params.eventIds = []
tableStore.table.params.status = '' tableStore.table.params.status = ''
tableStore.table.params.target = [] tableStore.table.params.target = []
tableStore.table.params.userId = '' tableStore.table.params.userId = ''
tableStore.table.params.deviceTypeId = '' tableStore.table.params.deviceTypeId = ''
tableStore.table.params.deviceTypeName = '' tableStore.table.params.deviceTypeName = ''
const deviceTreeOptions = ref<any>(props.deviceTree) const deviceTreeOptions = ref<any>(props.deviceTree)
deviceTreeOptions.value.map((item: any, index: any) => { deviceTreeOptions.value.map((item: any, index: any) => {
if (item.children.length == 0) { if (item.children.length == 0) {
deviceTreeOptions.value.splice(index, 1) deviceTreeOptions.value.splice(index, 1)
} }
}) })
const sourceChange = (e: any) => { const sourceChange = (e: any) => {
tableStore.table.params.deviceTypeId = '' tableStore.table.params.deviceTypeId = ''
tableStore.table.params.engineeringid = '' tableStore.table.params.engineeringid = ''
tableStore.table.params.projectId = '' tableStore.table.params.projectId = ''
tableStore.table.params.deviceId = '' tableStore.table.params.deviceId = ''
if (e) { if (e) {
let name = deviceTreeOptions.value.filter((item: any) => { let name = deviceTreeOptions.value.filter((item: any) => {
return item.id == e[0] return item.id == e[0]
})[0].name })[0].name
tableStore.table.params.deviceTypeName = name tableStore.table.params.deviceTypeName = name
if (name == '便携式设备') { if (name == '便携式设备') {
tableStore.table.params.deviceTypeId = e[0] || '' tableStore.table.params.deviceTypeId = e[0] || ''
tableStore.table.params.deviceId = e[1] || '' tableStore.table.params.deviceId = e[1] || ''
} else { } else {
tableStore.table.params.deviceTypeId = e[0] || '' tableStore.table.params.deviceTypeId = e[0] || ''
tableStore.table.params.engineeringid = e[1] || '' tableStore.table.params.engineeringid = e[1] || ''
tableStore.table.params.projectId = e[2] || '' tableStore.table.params.projectId = e[2] || ''
} }
} }
} }
onMounted(() => { onMounted(() => {
tableStore.index() tableStore.index()
}) })
setTimeout(() => { setTimeout(() => {
// tableStore.table.height = mainHeight(200).height as any // tableStore.table.height = mainHeight(200).height as any
}, 0) }, 0)
const addMenu = () => {} const addMenu = () => {}
</script> </script>
<style></style> <style></style>

View File

@@ -1,147 +1,147 @@
<template> <template>
<TableHeader datePicker ref="refheader" showExport> <TableHeader datePicker ref="refheader" showExport>
<template v-slot:select> <template v-slot:select>
<el-form-item label="数据来源"> <el-form-item label="数据来源">
<el-cascader <el-cascader
v-model.trim="tableStore.table.params.cascader" v-model.trim="tableStore.table.params.cascader"
filterable filterable
placeholder="请选择数据来源" placeholder="请选择数据来源"
@change="sourceChange" @change="sourceChange"
:options="deviceTreeOptions" :options="deviceTreeOptions"
:show-all-levels="false" :show-all-levels="false"
:props="{ checkStrictly: true }" :props="{ checkStrictly: true }"
clearable clearable
></el-cascader> ></el-cascader>
<!-- <el-input maxlength="32" show-word-limit v-model.trim="tableStore.table.params.searchValue" placeholder="请输入设备名称" /> --> <!-- <el-input maxlength="32" show-word-limit v-model.trim="tableStore.table.params.searchValue" placeholder="请输入设备名称" /> -->
</el-form-item> </el-form-item>
<!-- <el-form-item label="级别"> <!-- <el-form-item label="级别">
<el-select v-model.trim="tableStore.table.params.level" placeholder="请选择级别" clearable> <el-select v-model.trim="tableStore.table.params.level" placeholder="请选择级别" clearable>
<el-option <el-option
v-for="item in rankOptions" v-for="item in rankOptions"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> --> </el-form-item> -->
</template> </template>
</TableHeader> </TableHeader>
<!-- <div style="height: 300px;"> --> <!-- <div style="height: 300px;"> -->
<Table ref="tableRef" :isGroup="true" /> <Table ref="tableRef" :isGroup="true" />
<!-- </div> --> <!-- </div> -->
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, provide } from 'vue' import { ref, onMounted, provide } from 'vue'
import TableStore from '@/utils/tableStore' import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue' import Table from '@/components/table/index.vue'
import TableHeader from '@/components/table/header/index.vue' import TableHeader from '@/components/table/header/index.vue'
import { mainHeight } from '@/utils/layout' import { mainHeight } from '@/utils/layout'
const props = defineProps(['deviceTree']) const props = defineProps(['deviceTree'])
const refheader = ref() const refheader = ref()
const deviceTree = ref([]) const deviceTree = ref([])
const tabsList = ref([ const tabsList = ref([
{ {
label: '设备告警', label: '设备告警',
name: 3 name: 3
}, },
{ {
label: '稳态越限告警', label: '稳态越限告警',
name: 1 name: 1
}, },
{ {
label: '暂态事件', label: '暂态事件',
name: 0 name: 0
} }
]) ])
const rankOptions = ref([ const rankOptions = ref([
{ {
value: '1', value: '1',
label: '1级' label: '1级'
}, },
{ {
value: '2', value: '2',
label: '2级' label: '2级'
}, },
{ {
value: '3', value: '3',
label: '3级' label: '3级'
} }
]) ])
const tableStore = new TableStore({ const tableStore = new TableStore({
url: '/cs-harmonic-boot/eventUser/queryEventpageWeb', url: '/cs-harmonic-boot/eventUser/queryEventpageWeb',
method: 'POST', method: 'POST',
exportName: '稳态越限告警', exportName: '稳态越限告警',
publicHeight: 65, publicHeight: 65,
column: [ column: [
{ {
title: '序号', title: '序号',
width: 80, width: 80,
formatter: (row: any) => { formatter: (row: any) => {
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1 return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
} }
}, },
{ title: '设备名称', field: 'equipmentName', align: 'center' }, { title: '设备名称', field: 'equipmentName', align: 'center' },
{ title: '工程名称', field: 'engineeringName', align: 'center' }, { title: '工程名称', field: 'engineeringName', align: 'center' },
{ title: '项目名称', field: 'projectName', align: 'center' }, { title: '项目名称', field: 'projectName', align: 'center' },
{ title: '发生时刻', field: 'startTime', align: 'center', sortable: true }, { title: '发生时刻', field: 'startTime', align: 'center', sortable: true },
{ title: '事件描述', field: 'showName', align: 'center' } { title: '事件描述', field: 'showName', align: 'center' }
], ],
beforeSearchFun: () => {} beforeSearchFun: () => {}
}) })
provide('tableStore', tableStore) provide('tableStore', tableStore)
// "target": [], // "target": [],
// "type": "", // "type": "",
// "userId": "" // "userId": ""
tableStore.table.params.engineeringid = '' tableStore.table.params.engineeringid = ''
tableStore.table.params.deviceTypeId = '' tableStore.table.params.deviceTypeId = ''
tableStore.table.params.projectId = '' tableStore.table.params.projectId = ''
tableStore.table.params.deviceId = '' tableStore.table.params.deviceId = ''
tableStore.table.params.type = 1 tableStore.table.params.type = 1
tableStore.table.params.eventIds = [] tableStore.table.params.eventIds = []
tableStore.table.params.status = '' tableStore.table.params.status = ''
tableStore.table.params.target = [] tableStore.table.params.target = []
tableStore.table.params.userId = '' tableStore.table.params.userId = ''
tableStore.table.params.cascader = '' tableStore.table.params.cascader = ''
tableStore.table.params.deviceTypeName = '' tableStore.table.params.deviceTypeName = ''
// tableStore.table.params.level='' // tableStore.table.params.level=''
const deviceTreeOptions = ref<any>(props.deviceTree) const deviceTreeOptions = ref<any>(props.deviceTree)
deviceTreeOptions.value.map((item: any, index: any) => { deviceTreeOptions.value.map((item: any, index: any) => {
if (item.children.length == 0) { if (item.children.length == 0) {
deviceTreeOptions.value.splice(index, 1) deviceTreeOptions.value.splice(index, 1)
} }
}) })
const sourceChange = (e: any) => { const sourceChange = (e: any) => {
tableStore.table.params.deviceTypeId = '' tableStore.table.params.deviceTypeId = ''
tableStore.table.params.engineeringid = '' tableStore.table.params.engineeringid = ''
tableStore.table.params.projectId = '' tableStore.table.params.projectId = ''
tableStore.table.params.deviceId = '' tableStore.table.params.deviceId = ''
if (e) { if (e) {
let name = deviceTreeOptions.value.filter((item: any) => { let name = deviceTreeOptions.value.filter((item: any) => {
return item.id == e[0] return item.id == e[0]
})[0].name })[0].name
tableStore.table.params.deviceTypeName = name tableStore.table.params.deviceTypeName = name
if (name == '便携式设备') { if (name == '便携式设备') {
tableStore.table.params.deviceTypeId = e[0] || '' tableStore.table.params.deviceTypeId = e[0] || ''
tableStore.table.params.deviceId = e[1] || '' tableStore.table.params.deviceId = e[1] || ''
} else { } else {
tableStore.table.params.deviceTypeId = e[0] || '' tableStore.table.params.deviceTypeId = e[0] || ''
tableStore.table.params.engineeringid = e[1] || '' tableStore.table.params.engineeringid = e[1] || ''
tableStore.table.params.projectId = e[2] || '' tableStore.table.params.projectId = e[2] || ''
} }
} }
} }
onMounted(() => { onMounted(() => {
tableStore.index() tableStore.index()
}) })
setTimeout(() => { setTimeout(() => {
tableStore.table.height = mainHeight(200).height as any tableStore.table.height = mainHeight(200).height as any
}, 0) }, 0)
const addMenu = () => {} const addMenu = () => {}
</script> </script>
<style></style> <style></style>

View File

@@ -1,365 +1,365 @@
<template> <template>
<div ref="refheader" v-if="!isWaveCharts"> <div ref="refheader" v-if="!isWaveCharts">
<TableHeader datePicker showExport> <TableHeader datePicker showExport>
<template v-slot:select> <template v-slot:select>
<el-form-item label="数据来源"> <el-form-item label="数据来源">
<el-cascader <el-cascader
placeholder="请选择数据来源" placeholder="请选择数据来源"
@change="sourceChange" @change="sourceChange"
filterable filterable
v-model.trim="tableStore.table.params.cascader" v-model.trim="tableStore.table.params.cascader"
:options="deviceTreeOptions" :options="deviceTreeOptions"
:show-all-levels="false" :show-all-levels="false"
:props="{ checkStrictly: true }" :props="{ checkStrictly: true }"
clearable clearable
></el-cascader> ></el-cascader>
<!-- <el-input maxlength="32" show-word-limit v-model.trim="tableStore.table.params.searchValue" placeholder="请输入设备名称" /> --> <!-- <el-input maxlength="32" show-word-limit v-model.trim="tableStore.table.params.searchValue" placeholder="请输入设备名称" /> -->
</el-form-item> </el-form-item>
<!-- <el-form-item label="级别"> <!-- <el-form-item label="级别">
<el-select v-model.trim="tableStore.table.params.level" placeholder="请选择级别" clearable> <el-select v-model.trim="tableStore.table.params.level" placeholder="请选择级别" clearable>
<el-option v-for="item in rankOptions" :key="item.value" :label="item.label" <el-option v-for="item in rankOptions" :key="item.value" :label="item.label"
:value="item.value"></el-option> :value="item.value"></el-option>
</el-select> </el-select>
</el-form-item> --> </el-form-item> -->
</template> </template>
</TableHeader> </TableHeader>
<Table></Table> <Table></Table>
</div> </div>
<waveFormAnalysis <waveFormAnalysis
v-loading="loading" v-loading="loading"
v-if="isWaveCharts" v-if="isWaveCharts"
ref="waveFormAnalysisRef" ref="waveFormAnalysisRef"
@handleHideCharts="isWaveCharts = false" @handleHideCharts="isWaveCharts = false"
:wp="wp" :wp="wp"
/> />
<!-- <div style="height: 300px;"> --> <!-- <div style="height: 300px;"> -->
<!-- <div style="padding: 10px" v-if="!view" v-loading="loading"> <!-- <div style="padding: 10px" v-if="!view" v-loading="loading">
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<div v-if="view2" style="display: flex"> <div v-if="view2" style="display: flex">
<el-radio-group v-model.trim="value" @change="changeView"> <el-radio-group v-model.trim="value" @change="changeView">
<el-radio-button label="一次值" :value="1" /> <el-radio-button label="一次值" :value="1" />
<el-radio-button label="二次值" :value="2" /> <el-radio-button label="二次值" :value="2" />
</el-radio-group> </el-radio-group>
</div> </div>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-button v-if="view2" @click="backbxlb" class="el-icon-refresh-right" icon="el-icon-Back" <el-button v-if="view2" @click="backbxlb" class="el-icon-refresh-right" icon="el-icon-Back"
style="float: right"> style="float: right">
返回 返回
</el-button> </el-button>
</el-col> </el-col>
</el-row> </el-row>
<el-tabs v-if="view2" v-model.trim="bxactiveName" @tab-click="bxhandleClick"> <el-tabs v-if="view2" v-model.trim="bxactiveName" @tab-click="bxhandleClick">
<el-tab-pane label="瞬时波形" name="ssbx" class="boxbx pt10 pb10" <el-tab-pane label="瞬时波形" name="ssbx" class="boxbx pt10 pb10"
:style="'height:' + bxecharts + ';overflow-y: scroll;'"> :style="'height:' + bxecharts + ';overflow-y: scroll;'">
<shushiboxi v-if="bxactiveName == 'ssbx' && showBoxi" :value="value" :boxoList="boxoList" :wp="wp"> <shushiboxi v-if="bxactiveName == 'ssbx' && showBoxi" :value="value" :boxoList="boxoList" :wp="wp">
</shushiboxi> </shushiboxi>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="RMS波形" class="boxbx pt10 pb10" name="rmsbx" <el-tab-pane label="RMS波形" class="boxbx pt10 pb10" name="rmsbx"
:style="'height:' + bxecharts + ';overflow-y: scroll;'"> :style="'height:' + bxecharts + ';overflow-y: scroll;'">
<rmsboxi v-if="bxactiveName == 'rmsbx' && showBoxi" :value="value" :boxoList="boxoList" :wp="wp"> <rmsboxi v-if="bxactiveName == 'rmsbx' && showBoxi" :value="value" :boxoList="boxoList" :wp="wp">
</rmsboxi> </rmsboxi>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</div> --> </div> -->
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, provide, nextTick } from 'vue' import { ref, onMounted, provide, nextTick } from 'vue'
import TableStore from '@/utils/tableStore' import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue' import Table from '@/components/table/index.vue'
import TableHeader from '@/components/table/header/index.vue' import TableHeader from '@/components/table/header/index.vue'
import shushiboxi from '@/components/echarts/shushiboxi.vue' import shushiboxi from '@/components/echarts/shushiboxi.vue'
import waveFormAnalysis from '@/views/govern/device/control/tabs/components/waveFormAnalysis.vue' import waveFormAnalysis from '@/views/govern/device/control/tabs/components/waveFormAnalysis.vue'
import rmsboxi from '@/components/echarts/rmsboxi.vue' import rmsboxi from '@/components/echarts/rmsboxi.vue'
import { analyseWave } from '@/api/common' import { analyseWave } from '@/api/common'
import { mainHeight } from '@/utils/layout' import { mainHeight } from '@/utils/layout'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { getFileZip } from '@/api/cs-harmonic-boot/datatrend' import { getFileZip } from '@/api/cs-harmonic-boot/datatrend'
const props = defineProps(['deviceTree']) const props = defineProps(['deviceTree'])
const refheader = ref() const refheader = ref()
const waveFormAnalysisRef = ref() const waveFormAnalysisRef = ref()
const view = ref(true) const view = ref(true)
const isWaveCharts = ref(false) const isWaveCharts = ref(false)
const view2 = ref(false) const view2 = ref(false)
const showBoxi = ref(true) const showBoxi = ref(true)
const loading = ref(false) const loading = ref(false)
const bxactiveName = ref('ssbx') const bxactiveName = ref('ssbx')
const boxoList: any = ref({}) const boxoList: any = ref({})
const wp = ref({}) const wp = ref({})
const value = ref(1) const value = ref(1)
const options = ref([ const options = ref([
{ {
value: 1, value: 1,
label: '一次值' label: '一次值'
}, },
{ {
value: 2, value: 2,
label: '二次值' label: '二次值'
} }
]) ])
const rankOptions = ref([ const rankOptions = ref([
{ {
value: '1', value: '1',
label: '1级' label: '1级'
}, },
{ {
value: '2', value: '2',
label: '2级' label: '2级'
}, },
{ {
value: '3', value: '3',
label: '3级' label: '3级'
} }
]) ])
const tableStore = new TableStore({ const tableStore = new TableStore({
url: '/cs-harmonic-boot/eventUser/queryEventpageWeb', url: '/cs-harmonic-boot/eventUser/queryEventpageWeb',
method: 'POST', method: 'POST',
publicHeight: 65, publicHeight: 65,
exportName: '暂态事件', exportName: '暂态事件',
column: [ { column: [ {
title: '序号', title: '序号',
width: 80, width: 80,
formatter: (row: any) => { formatter: (row: any) => {
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1 return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
} }
}, },
{ title: '设备名称', field: 'equipmentName', align: 'center' }, { title: '设备名称', field: 'equipmentName', align: 'center' },
{ title: '工程名称', field: 'engineeringName', align: 'center' }, { title: '工程名称', field: 'engineeringName', align: 'center' },
{ title: '项目名称', field: 'projectName', align: 'center' }, { title: '项目名称', field: 'projectName', align: 'center' },
{ title: '发生时刻', field: 'startTime', align: 'center', width: '240',sortable: true }, { title: '发生时刻', field: 'startTime', align: 'center', width: '240',sortable: true },
{ title: '监测点名称', field: 'lineName', align: 'center' }, { title: '监测点名称', field: 'lineName', align: 'center' },
{ title: '事件描述', field: 'showName', align: 'center' }, { title: '事件描述', field: 'showName', align: 'center' },
{ title: '事件发生位置', field: 'evtParamPosition', align: 'center' }, { title: '事件发生位置', field: 'evtParamPosition', align: 'center' },
{ title: '相别', field: 'evtParamPhase', align: 'center' }, { title: '相别', field: 'evtParamPhase', align: 'center' },
{ title: '持续时间(s)', field: 'evtParamTm', align: 'center',sortable: true }, { title: '持续时间(s)', field: 'evtParamTm', align: 'center',sortable: true },
{ title: '暂降(聚升)幅值(%)', minWidth: 100, field: 'evtParamVVaDepth', align: 'center',sortable: true }, { title: '暂降(聚升)幅值(%)', minWidth: 100, field: 'evtParamVVaDepth', align: 'center',sortable: true },
{ {
title: '操作', title: '操作',
align: 'center', align: 'center',
width: '180', width: '180',
render: 'buttons', render: 'buttons',
buttons: [ buttons: [
{ {
name: 'edit', name: 'edit',
title: '波形分析', title: '波形分析',
type: 'primary', type: 'primary',
icon: 'el-icon-DataLine', icon: 'el-icon-DataLine',
render: 'basicButton', render: 'basicButton',
loading: 'loading1', loading: 'loading1',
disabled: row => { disabled: row => {
return !row.wavePath && row.evtParamTm < 20 return !row.wavePath && row.evtParamTm < 20
}, },
click: async row => { click: async row => {
row.loading1 = true row.loading1 = true
loading.value = true loading.value = true
isWaveCharts.value = true isWaveCharts.value = true
await analyseWave(row.id) await analyseWave(row.id)
.then(res => { .then(res => {
row.loading1 = false row.loading1 = false
if (res != undefined) { if (res != undefined) {
boxoList.value = row boxoList.value = row
boxoList.value.featureAmplitude = boxoList.value.featureAmplitude =
row.evtParamVVaDepth != '-' ? row.evtParamVVaDepth - 0 : null row.evtParamVVaDepth != '-' ? row.evtParamVVaDepth - 0 : null
boxoList.value.systemType = 'WX' boxoList.value.systemType = 'WX'
wp.value = res.data wp.value = res.data
} }
loading.value = false loading.value = false
}) })
.catch(() => { .catch(() => {
row.loading1 = false row.loading1 = false
loading.value = false loading.value = false
}) })
nextTick(() => { nextTick(() => {
waveFormAnalysisRef.value && waveFormAnalysisRef.value &&
waveFormAnalysisRef.value.getWpData(wp.value, boxoList.value, true) waveFormAnalysisRef.value.getWpData(wp.value, boxoList.value, true)
// waveFormAnalysisRef.value && waveFormAnalysisRef.value.setHeight(200, 190) // waveFormAnalysisRef.value && waveFormAnalysisRef.value.setHeight(200, 190)
}) })
// row.loading1 = true // row.loading1 = true
// view.value = false // view.value = false
// view2.value = true // view2.value = true
// loading.value = true // loading.value = true
// boxoList.value = row // boxoList.value = row
// boxoList.value.systemType = 'WX' // boxoList.value.systemType = 'WX'
// boxoList.value.persistTime = row.evtParamTm != '-' ? row.evtParamTm - 0 : null // boxoList.value.persistTime = row.evtParamTm != '-' ? row.evtParamTm - 0 : null
// await analyseWave(row.id) // await analyseWave(row.id)
// .then(res => { // .then(res => {
// row.loading1 = false // row.loading1 = false
// if (res != undefined) { // if (res != undefined) {
// wp.value = res.data // wp.value = res.data
// } // }
// loading.value = false // loading.value = false
// }) // })
// .catch(() => { // .catch(() => {
// row.loading1 = false // row.loading1 = false
// loading.value = false // loading.value = false
// }) // })
} }
}, },
{ {
name: 'edit', name: 'edit',
title: '波形下载', title: '波形下载',
type: 'primary', type: 'primary',
icon: 'el-icon-Check', icon: 'el-icon-Check',
loading: 'loading2', loading: 'loading2',
render: 'basicButton', render: 'basicButton',
disabled: row => { disabled: row => {
// && row.evtParamTm < 20 // && row.evtParamTm < 20
return !row.wavePath return !row.wavePath
}, },
click: row => { click: row => {
getFileZip({ eventId: row.id }).then(res => { getFileZip({ eventId: row.id }).then(res => {
let blob = new Blob([res], { type: 'application/zip' }) // console.log(blob) // var href = window.URL.createObjectURL(blob); //创建下载的链接 let blob = new Blob([res], { type: 'application/zip' }) // console.log(blob) // var href = window.URL.createObjectURL(blob); //创建下载的链接
const url = window.URL.createObjectURL(blob) const url = window.URL.createObjectURL(blob)
const link = document.createElement('a') // 创建a标签 const link = document.createElement('a') // 创建a标签
link.href = url link.href = url
link.download = row.wavePath.split('/')[2] || '波形文件' // 设置下载的文件名 link.download = row.wavePath.split('/')[2] || '波形文件' // 设置下载的文件名
document.body.appendChild(link) document.body.appendChild(link)
link.click() //执行下载 link.click() //执行下载
document.body.removeChild(link) //释放标签 document.body.removeChild(link) //释放标签
}) })
} }
}, },
{ {
name: 'edit', name: 'edit',
text: '暂无波形', text: '暂无波形',
type: 'info', type: 'info',
icon: 'el-icon-DataLine', icon: 'el-icon-DataLine',
render: 'basicButton', render: 'basicButton',
disabled: row => { disabled: row => {
return !(!row.wavePath && row.evtParamTm < 20) return !(!row.wavePath && row.evtParamTm < 20)
} }
} }
] ]
} }
], ],
beforeSearchFun: () => { beforeSearchFun: () => {
// if (!tableStore.table.params.deviceId) { // if (!tableStore.table.params.deviceId) {
// delete tableStore.table.params.deviceId // delete tableStore.table.params.deviceId
// } // }
}, },
loadCallback: () => { loadCallback: () => {
tableStore.table.data.forEach((item: any) => { tableStore.table.data.forEach((item: any) => {
item.loading = false item.loading = false
item.evtParamTm = item.evtParamTm =
item.evtParamTm.split('s')[0] != '-' ? (item.evtParamTm.split('s')[0] - 0).toFixed(2) : '-' item.evtParamTm.split('s')[0] != '-' ? (item.evtParamTm.split('s')[0] - 0).toFixed(2) : '-'
item.evtParamVVaDepth = item.evtParamVVaDepth =
item.evtParamVVaDepth.split('%')[0] != '-' ? (item.evtParamVVaDepth.split('%')[0] - 0).toFixed(2) : '-' item.evtParamVVaDepth.split('%')[0] != '-' ? (item.evtParamVVaDepth.split('%')[0] - 0).toFixed(2) : '-'
}) })
} }
}) })
provide('tableStore', tableStore) provide('tableStore', tableStore)
// "target": [], // "target": [],
// "type": "", // "type": "",
// "userId": "" // "userId": ""
tableStore.table.params.engineeringid = '' tableStore.table.params.engineeringid = ''
tableStore.table.params.projectId = '' tableStore.table.params.projectId = ''
tableStore.table.params.deviceTypeId = '' tableStore.table.params.deviceTypeId = ''
tableStore.table.params.deviceId = '' tableStore.table.params.deviceId = ''
tableStore.table.params.type = 0 tableStore.table.params.type = 0
tableStore.table.params.eventIds = [] tableStore.table.params.eventIds = []
tableStore.table.params.status = '' tableStore.table.params.status = ''
tableStore.table.params.target = [] tableStore.table.params.target = []
tableStore.table.params.userId = '' tableStore.table.params.userId = ''
tableStore.table.params.cascader = '' tableStore.table.params.cascader = ''
tableStore.table.params.deviceTypeName = '' tableStore.table.params.deviceTypeName = ''
// tableStore.table.params.level='' // tableStore.table.params.level=''
const deviceTreeOptions: any = ref<any>(props.deviceTree) const deviceTreeOptions: any = ref<any>(props.deviceTree)
deviceTreeOptions.value.map((item: any, index: any) => { deviceTreeOptions.value.map((item: any, index: any) => {
if (item.children.length == 0) { if (item.children.length == 0) {
deviceTreeOptions.value.splice(index, 1) deviceTreeOptions.value.splice(index, 1)
} }
}) })
const sourceChange = (e: any) => { const sourceChange = (e: any) => {
tableStore.table.params.deviceTypeId = '' tableStore.table.params.deviceTypeId = ''
tableStore.table.params.engineeringid = '' tableStore.table.params.engineeringid = ''
tableStore.table.params.projectId = '' tableStore.table.params.projectId = ''
tableStore.table.params.deviceId = '' tableStore.table.params.deviceId = ''
if (e) { if (e) {
let name = deviceTreeOptions.value.filter((item: any) => { let name = deviceTreeOptions.value.filter((item: any) => {
return item.id == e[0] return item.id == e[0]
})[0].name })[0].name
tableStore.table.params.deviceTypeName = name tableStore.table.params.deviceTypeName = name
if (name == '便携式设备') { if (name == '便携式设备') {
tableStore.table.params.deviceTypeId = e[0] || '' tableStore.table.params.deviceTypeId = e[0] || ''
tableStore.table.params.deviceId = e[1] || '' tableStore.table.params.deviceId = e[1] || ''
} else { } else {
tableStore.table.params.deviceTypeId = e[0] || '' tableStore.table.params.deviceTypeId = e[0] || ''
tableStore.table.params.engineeringid = e[1] || '' tableStore.table.params.engineeringid = e[1] || ''
tableStore.table.params.projectId = e[2] || '' tableStore.table.params.projectId = e[2] || ''
} }
} }
// tableStore.table.params.engineeringid = e[1] || '' // tableStore.table.params.engineeringid = e[1] || ''
// tableStore.table.params.projectId = e[2] || '' // tableStore.table.params.projectId = e[2] || ''
// const zlIndex = deviceTreeOptions.value.findIndex((item: any) => { // const zlIndex = deviceTreeOptions.value.findIndex((item: any) => {
// return item.name == '治理设备' // return item.name == '治理设备'
// }) // })
// const bxsIndex = deviceTreeOptions.value.findIndex((item: any) => { // const bxsIndex = deviceTreeOptions.value.findIndex((item: any) => {
// return item.name == '便携式设备' // return item.name == '便携式设备'
// }) // })
// console.log("🚀 ~ zlIndex ~ zlIndex:", zlIndex,bxsIndex) // console.log("🚀 ~ zlIndex ~ zlIndex:", zlIndex,bxsIndex)
// //便携式设备特殊处理 // //便携式设备特殊处理
// if (bxsIndex != -1 && deviceTreeOptions.value[bxsIndex].id == e[0] && e.length == 2) { // if (bxsIndex != -1 && deviceTreeOptions.value[bxsIndex].id == e[0] && e.length == 2) {
// tableStore.table.params.deviceId = e[1] // tableStore.table.params.deviceId = e[1]
// } // }
// //治理设备 // //治理设备
// if (zlIndex != -1 && deviceTreeOptions.value[zlIndex].id == e[0]) { // if (zlIndex != -1 && deviceTreeOptions.value[zlIndex].id == e[0]) {
// tableStore.table.params.deviceId = e[2] || '' // tableStore.table.params.deviceId = e[2] || ''
// } // }
} }
const getboxin = async (row: any) => { const getboxin = async (row: any) => {
console.log('🚀 ~ getboxin ~ row:', row) console.log('🚀 ~ getboxin ~ row:', row)
// boxoList.value = row // boxoList.value = row
// await analyseWave(row.id).then(res => { // await analyseWave(row.id).then(res => {
// if (res != undefined) { // if (res != undefined) {
// wp.value = res.data // wp.value = res.data
// view.value = false // view.value = false
// view2.value = true // view2.value = true
// } // }
// }) // })
} }
const changeView = () => { const changeView = () => {
showBoxi.value = false showBoxi.value = false
setTimeout(() => { setTimeout(() => {
showBoxi.value = true showBoxi.value = true
}, 0) }, 0)
} }
const bxhandleClick = (tab: any) => { const bxhandleClick = (tab: any) => {
if (tab.name == 'ssbx') { if (tab.name == 'ssbx') {
bxactiveName.value = 'ssbx' bxactiveName.value = 'ssbx'
} else if (tab.name == 'rmsbx') { } else if (tab.name == 'rmsbx') {
bxactiveName.value = 'rmsbx' bxactiveName.value = 'rmsbx'
} }
// console.log(tab, event); // console.log(tab, event);
} }
const backbxlb = () => { const backbxlb = () => {
view.value = true view.value = true
view2.value = false view2.value = false
setTimeout(() => { setTimeout(() => {
tableStore.table.height = mainHeight(180).height as any tableStore.table.height = mainHeight(180).height as any
}, 0) }, 0)
} }
onMounted(() => { onMounted(() => {
tableStore.index() tableStore.index()
}) })
const bxecharts = mainHeight(175).height as any const bxecharts = mainHeight(175).height as any
setTimeout(() => { setTimeout(() => {
tableStore.table.height = mainHeight(200).height as any tableStore.table.height = mainHeight(200).height as any
}, 0) }, 0)
const addMenu = () => {} const addMenu = () => {}
</script> </script>
<style scoped lang="scss"></style> <style scoped lang="scss"></style>

View File

@@ -1,202 +1,202 @@
<template> <template>
<div class="default-main"> <div class="default-main">
<TableHeader datePicker ref="refheader" > <TableHeader datePicker ref="refheader" >
<template v-slot:select> <template v-slot:select>
<el-form-item label="关键字筛选"> <el-form-item label="关键字筛选">
<el-input <el-input
v-model.trim="tableStore.table.params.name" v-model.trim="tableStore.table.params.name"
placeholder="请输入关键字" placeholder="请输入关键字"
clearable clearable
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="流程阶段"> <el-form-item label="流程阶段">
<el-select v-model.trim="tableStore.table.params.process" clearable placeholder="请选择"> <el-select v-model.trim="tableStore.table.params.process" clearable placeholder="请选择">
<el-option label="功能调试" :value="2"></el-option> <el-option label="功能调试" :value="2"></el-option>
<el-option label="出厂调试" :value="3"></el-option> <el-option label="出厂调试" :value="3"></el-option>
<el-option label="正式投运" :value="4"></el-option> <el-option label="正式投运" :value="4"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</template> </template>
<template v-slot:operation> <template v-slot:operation>
<el-button type="primary" icon="el-icon-Download" @click="exportTab">导出</el-button> <el-button type="primary" icon="el-icon-Download" @click="exportTab">导出</el-button>
</template> </template>
</TableHeader> </TableHeader>
<Table ref="tableRef" /> <Table ref="tableRef" />
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, provide } from 'vue' import { ref, onMounted, provide } from 'vue'
import TableStore from '@/utils/tableStore' import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue' import Table from '@/components/table/index.vue'
import TableHeader from '@/components/table/header/index.vue' import TableHeader from '@/components/table/header/index.vue'
import { queryByCode, queryByid, queryCsDictTree } from '@/api/system-boot/dictTree' import { queryByCode, queryByid, queryCsDictTree } from '@/api/system-boot/dictTree'
defineOptions({ defineOptions({
name: 'manage/monthly' name: 'manage/monthly'
}) })
const refheader = ref() const refheader = ref()
const devModelOptions: any = ref([]) const devModelOptions: any = ref([])
queryByCode('Device_Type').then(res => { queryByCode('Device_Type').then(res => {
queryByid(res.data.id).then(res => { queryByid(res.data.id).then(res => {
devModelOptions.value = res.data.map((item: any) => { devModelOptions.value = res.data.map((item: any) => {
return { return {
value: item.id, value: item.id,
label: item.name, label: item.name,
...item ...item
} }
}) })
}) })
tableStore.index() tableStore.index()
}) })
const tableStore = new TableStore({ const tableStore = new TableStore({
url: '/cs-harmonic-boot/statisticsData/halfMonthReport', url: '/cs-harmonic-boot/statisticsData/halfMonthReport',
method: 'POST', method: 'POST',
isWebPaging: true, isWebPaging: true,
exportName: '半月报功能', exportName: '半月报功能',
column: [ column: [
{ {
title: '序号', title: '序号',
width: 80, width: 80,
formatter: (row: any) => { formatter: (row: any) => {
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1 return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
} }
}, },
{ title: '工程名称', field: 'engineeringName', minWidth: 150 }, { title: '工程名称', field: 'engineeringName', minWidth: 150 },
{ title: '项目名称', field: 'projectName', minWidth: 130 }, { title: '项目名称', field: 'projectName', minWidth: 130 },
{ title: '设备名称', field: 'devName', minWidth: 130 }, { title: '设备名称', field: 'devName', minWidth: 130 },
{ title: '监测点名称', field: 'lineName', minWidth: 130 }, { title: '监测点名称', field: 'lineName', minWidth: 130 },
{ {
title: '投运时间', title: '投运时间',
field: 'operationalTime', field: 'operationalTime',
width: 180, width: 180,
sortable: true sortable: true
}, },
{ {
title: '数据更新时间', title: '数据更新时间',
field: 'latestTime', field: 'latestTime',
width: 180, width: 180,
sortable: true sortable: true
// formatter: (row: any) => { // formatter: (row: any) => {
// return row.cellValue || '/' // return row.cellValue || '/'
// } // }
}, },
{ {
title: '设备型号', title: '设备型号',
field: 'devType', field: 'devType',
width: 130, width: 130,
formatter: row => { formatter: row => {
return devModelOptions.value.filter((item: any) => item.value == row.cellValue)[0]?.label return devModelOptions.value.filter((item: any) => item.value == row.cellValue)[0]?.label
} }
}, },
{ title: 'Mac地址', field: 'mac', width: 140 }, { title: 'Mac地址', field: 'mac', width: 140 },
{ {
title: '流程阶段', title: '流程阶段',
field: 'process', field: 'process',
width: 100, width: 100,
fixed: 'right', fixed: 'right',
render: 'tag', render: 'tag',
custom: { custom: {
2: 'warning', 2: 'warning',
3: 'warning', 3: 'warning',
4: 'success' 4: 'success'
}, },
replaceValue: { replaceValue: {
2: '功能调试', 2: '功能调试',
3: '出厂调试', 3: '出厂调试',
4: '正式投运' 4: '正式投运'
}, },
minWidth: 80 minWidth: 80
}, },
{ {
title: '运行状态', title: '运行状态',
field: 'operationalStatus', field: 'operationalStatus',
render: 'tag', render: 'tag',
fixed: 'right', fixed: 'right',
width: 100, width: 100,
custom: { custom: {
停运: 'danger', 停运: 'danger',
在运: 'success' 在运: 'success'
}, },
replaceValue: { replaceValue: {
在运: '在运', 在运: '在运',
停运: '停运' 停运: '停运'
} }
}, },
{ {
title: '通讯状态', title: '通讯状态',
field: 'communicationStatus', field: 'communicationStatus',
width: 100, width: 100,
fixed: 'right', fixed: 'right',
render: 'tag', render: 'tag',
custom: { custom: {
离线: 'danger', 离线: 'danger',
在线: 'success' 在线: 'success'
}, },
replaceValue: { replaceValue: {
离线: '离线', 离线: '离线',
在线: '在线' 在线: '在线'
} }
}, },
{ title: '在线率(%)', fixed: 'right',width: 100, field: 'onlineRate', sortable: true }, { title: '在线率(%)', fixed: 'right',width: 100, field: 'onlineRate', sortable: true },
{ title: '完整性(%)', fixed: 'right',width: 100, field: 'integrity', sortable: true } { title: '完整性(%)', fixed: 'right',width: 100, field: 'integrity', sortable: true }
], ],
beforeSearchFun: () => {}, beforeSearchFun: () => {},
loadCallback: () => { loadCallback: () => {
let name = tableStore.table.params.name let name = tableStore.table.params.name
let data = tableStore.table.copyData.filter(item => { let data = tableStore.table.copyData.filter(item => {
// 处理latestTime默认值 // 处理latestTime默认值
item.latestTime = item.latestTime || '/' item.latestTime = item.latestTime || '/'
// 需要检查的字段列表 // 需要检查的字段列表
const fieldsToCheck = ['projectName', 'engineeringName', 'mac', 'devName', 'lineName'] const fieldsToCheck = ['projectName', 'engineeringName', 'mac', 'devName', 'lineName']
console.log( console.log(
'🚀 ~ fieldsToCheck.some(field => item[field]?.includes(name)):', '🚀 ~ fieldsToCheck.some(field => item[field]?.includes(name)):',
fieldsToCheck.some(field => item[field]?.includes(name)) fieldsToCheck.some(field => item[field]?.includes(name))
) )
// 检查任何一个字段包含搜索名称 // 检查任何一个字段包含搜索名称
return fieldsToCheck.some(field => item[field]?.includes(name)) return fieldsToCheck.some(field => item[field]?.includes(name))
}) })
tableStore.table.copyData = JSON.parse(JSON.stringify(data)) tableStore.table.copyData = JSON.parse(JSON.stringify(data))
tableStore.table.total = tableStore.table.copyData.length tableStore.table.total = tableStore.table.copyData.length
if (data.length == 0) { if (data.length == 0) {
tableStore.table.data = [] tableStore.table.data = []
} else { } else {
tableStore.table.data = JSON.parse( tableStore.table.data = JSON.parse(
JSON.stringify( JSON.stringify(
window.XEUtils.chunk(data, tableStore.table.params.pageSize)[tableStore.table.params.pageNum - 1] window.XEUtils.chunk(data, tableStore.table.params.pageSize)[tableStore.table.params.pageNum - 1]
) )
) )
} }
} }
}) })
provide('tableStore', tableStore) provide('tableStore', tableStore)
tableStore.table.params.process = 4 tableStore.table.params.process = 4
tableStore.table.params.name = '' tableStore.table.params.name = ''
const tableRef = ref() const tableRef = ref()
const exportTab = () => { const exportTab = () => {
tableRef.value.getRef()?.exportData({ tableRef.value.getRef()?.exportData({
filename: '半月报功能', // 文件名字 filename: '半月报功能', // 文件名字
sheetName: 'Sheet1', sheetName: 'Sheet1',
type: 'xlsx', //导出文件类型 xlsx 和 csv type: 'xlsx', //导出文件类型 xlsx 和 csv
useStyle: true, useStyle: true,
data: tableStore.table.copyData, // 数据源 // 过滤那个字段导出 data: tableStore.table.copyData, // 数据源 // 过滤那个字段导出
columnFilterMethod: function (column: any) { columnFilterMethod: function (column: any) {
return !( return !(
column.column.title === undefined || column.column.title === undefined ||
column.column.title === '序号' || column.column.title === '序号' ||
column.column.title === '操作' column.column.title === '操作'
) )
} }
}) })
} }
onMounted(() => {}) onMounted(() => {})
setTimeout(() => { setTimeout(() => {
// tableStore.table.height = mainHeight(200).height as any // tableStore.table.height = mainHeight(200).height as any
}, 0) }, 0)
const addMenu = () => {} const addMenu = () => {}
</script> </script>
<style></style> <style></style>

View File

@@ -1,105 +1,105 @@
<template> <template>
<div class="default-main"> <div class="default-main">
<div class="mb10" style="display: flex; justify-content: flex-end"> <div class="mb10" style="display: flex; justify-content: flex-end">
<el-upload <el-upload
ref="upload" ref="upload"
action="" action=""
:auto-upload="false" :auto-upload="false"
:show-file-list="false" :show-file-list="false"
:limit="1" :limit="1"
:on-change="beforeUpload" :on-change="beforeUpload"
> >
<el-button icon="el-icon-Upload" type="primary" class="mr10">导入excel</el-button> <el-button icon="el-icon-Upload" type="primary" class="mr10">导入excel</el-button>
</el-upload> </el-upload>
<el-button @click="downloadExcel" class="" type="primary" icon="el-icon-Download">导出excel</el-button> <el-button @click="downloadExcel" class="" type="primary" icon="el-icon-Download">导出excel</el-button>
<el-button icon="el-icon-ArrowLeftBold" @click="emit('shutDown')">返回</el-button> <el-button icon="el-icon-Back" @click="emit('shutDown')">返回</el-button>
</div> </div>
<div style="display: flex"> <div style="display: flex">
<div id="luckysheet" :style="{ height: height, flex: 1 }"></div> <div id="luckysheet" :style="{ height: height, flex: 1 }"></div>
</div> </div>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { exportExcel } from './export.js' import { exportExcel } from './export.js'
import { mainHeight } from '@/utils/layout' import { mainHeight } from '@/utils/layout'
import LuckyExcel from 'luckyexcel' import LuckyExcel from 'luckyexcel'
import { ref, onMounted } from 'vue' import { ref, onMounted } from 'vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { viewCustomReportTemplateById } from '@/api/harmonic-boot/luckyexcel' import { viewCustomReportTemplateById } from '@/api/harmonic-boot/luckyexcel'
const emit = defineEmits(['shutDown']) const emit = defineEmits(['shutDown'])
const height = mainHeight(65).height const height = mainHeight(65).height
const options: any = ref({ const options: any = ref({
container: 'luckysheet', container: 'luckysheet',
title: '', // 表 头名 title: '', // 表 头名
lang: 'zh', // 中文 lang: 'zh', // 中文
showtoolbar: false, // 是否显示工具栏 showtoolbar: false, // 是否显示工具栏
showinfobar: false, // 是否显示顶部信息栏 showinfobar: false, // 是否显示顶部信息栏
showsheetbar: true, // 是否显示底部sheet按钮 showsheetbar: true, // 是否显示底部sheet按钮
data: [ data: [
{ {
name: 'Cell', name: 'Cell',
index: 0, index: 0,
defaultRowHeight: 27, defaultRowHeight: 27,
defaultColWidth: 105, defaultColWidth: 105,
chart: [] //图表配置 chart: [] //图表配置
} }
] ]
}) })
// 加载luckysheet // 加载luckysheet
const info = () => { const info = () => {
luckysheet.create(options.value) luckysheet.create(options.value)
} }
//绑定value //绑定value
const setValue = (e: any) => { const setValue = (e: any) => {
let data = luckysheet.getRange() let data = luckysheet.getRange()
luckysheet.setCellValue( luckysheet.setCellValue(
data[0].row[0], data[0].row[0],
data[0].column[0], data[0].column[0],
{ {
v: e[e.length - 1], v: e[e.length - 1],
tr: e tr: e
} }
// checkedNodes[0].data.label // checkedNodes[0].data.label
) )
} }
// 下载表格 // 下载表格
const downloadExcel = () => { const downloadExcel = () => {
exportExcel(luckysheet.getAllSheets(), '报表模板') exportExcel(luckysheet.getAllSheets(), '报表模板')
} }
// 导入 // 导入
const beforeUpload = (file: any) => { const beforeUpload = (file: any) => {
LuckyExcel.transformExcelToLucky(file.raw, function (exportJson: any) { LuckyExcel.transformExcelToLucky(file.raw, function (exportJson: any) {
if (exportJson.sheets == null || exportJson.sheets.length == 0) { if (exportJson.sheets == null || exportJson.sheets.length == 0) {
ElMessage.warning('读取excel文件内容失败,目前只能上传xlsx文件!') ElMessage.warning('读取excel文件内容失败,目前只能上传xlsx文件!')
return return
} }
luckysheet.destroy() luckysheet.destroy()
options.value.title = exportJson.info.name options.value.title = exportJson.info.name
options.value.data = exportJson.sheets options.value.data = exportJson.sheets
luckysheet.create(options.value) luckysheet.create(options.value)
}) })
} }
const open = async (row: any) => { const open = async (row: any) => {
await viewCustomReportTemplateById({ id: row.id }).then((Response:any) => { await viewCustomReportTemplateById({ id: row.id }).then((Response:any) => {
Response.forEach((item: any) => { Response.forEach((item: any) => {
item.celldata.forEach((k: any) => { item.celldata.forEach((k: any) => {
item.data[k.r][k.c].v ? (item.data[k.r][k.c] = k.v ) : '' item.data[k.r][k.c].v ? (item.data[k.r][k.c] = k.v ) : ''
}) })
}) })
options.value.data = Response options.value.data = Response
}) })
info() info()
} }
defineExpose({ open }) defineExpose({ open })
onMounted(() => {}) onMounted(() => {})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
:deep(.el-tab-pane) { :deep(.el-tab-pane) {
padding: 10px; padding: 10px;
} }
</style> </style>

View File

@@ -1,159 +1,159 @@
<template> <template>
<div class="default-main"> <div class="default-main">
<div class="mb10" style="display: flex; justify-content: flex-end"> <div class="mb10" style="display: flex; justify-content: flex-end">
<el-upload ref="upload" action="" :auto-upload="false" :show-file-list="false" :limit="1" <el-upload ref="upload" action="" :auto-upload="false" :show-file-list="false" :limit="1"
:on-change="beforeUpload"> :on-change="beforeUpload">
<el-button icon="el-icon-Upload" type="primary" class="mr10">导入excel</el-button> <el-button icon="el-icon-Upload" type="primary" class="mr10">导入excel</el-button>
</el-upload> </el-upload>
<el-button @click="downloadExcel" class="" type="primary" icon="el-icon-Download">导出excel</el-button> <el-button @click="downloadExcel" class="" type="primary" icon="el-icon-Download">导出excel</el-button>
<el-button type="primary" icon="el-icon-Check" @click="preservation">保存</el-button> <el-button type="primary" icon="el-icon-Check" @click="preservation">保存</el-button>
<el-button icon="el-icon-ArrowLeftBold" @click="emit('shutDown')">返回</el-button> <el-button icon="el-icon-Back" @click="emit('shutDown')">返回</el-button>
</div> </div>
<div style="display: flex"> <div style="display: flex">
<div id="luckysheet" :style="{ height: height, flex: 1 }"></div> <div id="luckysheet" :style="{ height: height, flex: 1 }"></div>
<bind style="width: 500px" class="ml10" @setValue="setValue" /> <bind style="width: 500px" class="ml10" @setValue="setValue" />
</div> </div>
<!-- 信息框 --> <!-- 信息框 -->
<addForm ref="formFer" @submitForm="submitForm" /> <addForm ref="formFer" @submitForm="submitForm" />
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { exportExcel } from './export.js' import { exportExcel } from './export.js'
import { mainHeight } from '@/utils/layout' import { mainHeight } from '@/utils/layout'
import LuckyExcel from 'luckyexcel' import LuckyExcel from 'luckyexcel'
import { ref, onMounted } from 'vue' import { ref, onMounted } from 'vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { addTemplate, dateTemplateup, viewCustomReportTemplateById } from '@/api/harmonic-boot/luckyexcel' import { addTemplate, dateTemplateup, viewCustomReportTemplateById } from '@/api/harmonic-boot/luckyexcel'
import bind from './bind.vue' import bind from './bind.vue'
import addForm from './form.vue' import addForm from './form.vue'
const emit = defineEmits(['shutDown']) const emit = defineEmits(['shutDown'])
const formFer = ref() const formFer = ref()
const title = ref('') const title = ref('')
const list = ref({}) const list = ref({})
const height = mainHeight(65).height const height = mainHeight(65).height
const options: any = ref({ const options: any = ref({
container: 'luckysheet', container: 'luckysheet',
title: '', // 表 头名 title: '', // 表 头名
lang: 'zh', // 中文 lang: 'zh', // 中文
showtoolbar: true, // 是否显示工具栏 showtoolbar: true, // 是否显示工具栏
showinfobar: false, // 是否显示顶部信息栏 showinfobar: false, // 是否显示顶部信息栏
showsheetbar: true, // 是否显示底部sheet按钮 showsheetbar: true, // 是否显示底部sheet按钮
data: [ data: [
{ {
name: 'Cell', name: 'Cell',
index: 0, index: 0,
defaultRowHeight: 27, defaultRowHeight: 27,
defaultColWidth: 105, defaultColWidth: 105,
chart: [] //图表配置 chart: [] //图表配置
} }
] ]
}) })
// 加载luckysheet // 加载luckysheet
const info = () => { const info = () => {
luckysheet.create(options.value) luckysheet.create(options.value)
} }
//绑定value //绑定value
const setValue = (e: any) => { const setValue = (e: any) => {
let data = luckysheet.getRange() let data = luckysheet.getRange()
luckysheet.setCellValue( luckysheet.setCellValue(
data[0].row[0], data[0].row[0],
data[0].column[0], data[0].column[0],
{ {
v: e[e.length - 1], v: e[e.length - 1],
tr: e tr: e
} }
// checkedNodes[0].data.label // checkedNodes[0].data.label
) )
} }
// 下载表格 // 下载表格
const downloadExcel = () => { const downloadExcel = () => {
exportExcel(luckysheet.getAllSheets(), '报表模板') exportExcel(luckysheet.getAllSheets(), '报表模板')
} }
// 导入 // 导入
const beforeUpload = (file: any) => { const beforeUpload = (file: any) => {
LuckyExcel.transformExcelToLucky(file.raw, function (exportJson: any) { LuckyExcel.transformExcelToLucky(file.raw, function (exportJson: any) {
if (exportJson.sheets == null || exportJson.sheets.length == 0) { if (exportJson.sheets == null || exportJson.sheets.length == 0) {
ElMessage.warning('读取excel文件内容失败,目前只能上传xlsx文件!') ElMessage.warning('读取excel文件内容失败,目前只能上传xlsx文件!')
return return
} }
luckysheet.destroy() luckysheet.destroy()
options.value.title = exportJson.info.name options.value.title = exportJson.info.name
exportJson.sheets.forEach((item: any) => { exportJson.sheets.forEach((item: any) => {
// item.celldata = [] // item.celldata = []
// item.data = [] // item.data = []
item.celldata.forEach((k: any) => { item.celldata.forEach((k: any) => {
k.v.ct.s ? (k.v.v = k.v.ct.s[0].v) : '' k.v.ct.s ? (k.v.v = k.v.ct.s[0].v) : ''
k.v.ct.s ? (k.v.m = k.v.ct.s[0].v) : '' k.v.ct.s ? (k.v.m = k.v.ct.s[0].v) : ''
}) })
}) })
options.value.data = exportJson.sheets options.value.data = exportJson.sheets
luckysheet.create(options.value) luckysheet.create(options.value)
}) })
} }
// 保存 // 保存
const preservation = () => { const preservation = () => {
formFer.value.open(title.value, list.value) formFer.value.open(title.value, list.value)
} }
// 新增 // 新增
const submitForm = (formdata: any, text: string) => { const submitForm = (formdata: any, text: string) => {
// let userStr = JSON.stringify(luckysheet.getAllSheets()) // let userStr = JSON.stringify(luckysheet.getAllSheets())
let userStr = luckysheet.getAllSheets() let userStr = luckysheet.getAllSheets()
userStr.forEach((item: any) => { userStr.forEach((item: any) => {
item.data1 = JSON.stringify(item.data) item.data1 = JSON.stringify(item.data)
}) })
let blob = new Blob([JSON.stringify(userStr)], { let blob = new Blob([JSON.stringify(userStr)], {
type: 'application/json;charset=UTF-8' type: 'application/json;charset=UTF-8'
}) })
let files = new window.File([blob], 'content.json', { let files = new window.File([blob], 'content.json', {
type: 'application/json;charset=UTF-8' type: 'application/json;charset=UTF-8'
}) })
let params = new FormData() let params = new FormData()
params.append('fileContent', files) params.append('fileContent', files)
params.append('deptId', formdata.deptId) params.append('deptId', formdata.deptId)
params.append('valueTitle', formdata.deptId) params.append('valueTitle', formdata.deptId)
params.append('name', formdata.name) params.append('name', formdata.name)
params.append('reportType', formdata.reportType) params.append('reportType', formdata.reportType)
params.append('reportForm', formdata.reportForm) params.append('reportForm', formdata.reportForm)
ElMessage.info('正在保存请稍等!') ElMessage.info('正在保存请稍等!')
if (text == '新增报表模板') { if (text == '新增报表模板') {
addTemplate(params).then(res => { addTemplate(params).then(res => {
ElMessage.success('新增成功!') ElMessage.success('新增成功!')
formFer.value.shutDown() formFer.value.shutDown()
emit('shutDown') emit('shutDown')
}).catch(err => { }).catch(err => {
ElMessage.error('保存失败!') ElMessage.error('保存失败!')
formFer.value.shutDown() formFer.value.shutDown()
}) })
} else if (text == '编辑报表模板') { } else if (text == '编辑报表模板') {
params.append('id', list.value.id) params.append('id', list.value.id)
dateTemplateup(params).then(res => { dateTemplateup(params).then(res => {
ElMessage.success('编辑成功!') ElMessage.success('编辑成功!')
formFer.value.shutDown() formFer.value.shutDown()
emit('shutDown') emit('shutDown')
}).catch(err => { }).catch(err => {
ElMessage.error('保存失败!') ElMessage.error('保存失败!')
formFer.value.shutDown() formFer.value.shutDown()
}) })
} }
} }
const open = async (text: string, row?: any) => { const open = async (text: string, row?: any) => {
title.value = text title.value = text
if (row) { if (row) {
list.value = row list.value = row
await viewCustomReportTemplateById({ id: row.id }).then(Response => { await viewCustomReportTemplateById({ id: row.id }).then(Response => {
options.value.data = Response options.value.data = Response
}) })
} }
info() info()
} }
defineExpose({ open }) defineExpose({ open })
onMounted(() => { }) onMounted(() => { })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
:deep(.el-tab-pane) { :deep(.el-tab-pane) {
padding: 10px; padding: 10px;
} }
</style> </style>

View File

@@ -60,8 +60,8 @@ interface LayoutItem {
error?: any error?: any
} }
const key = ref(0) const key = ref(0)
const img = new URL(`@/assets/imgs/amplify.png`, import.meta.url) const img = new URL(`@/assets/img/amplify.png`, import.meta.url)
const img1 = new URL(`@/assets/imgs/reduce.png`, import.meta.url) const img1 = new URL(`@/assets/img/reduce.png`, import.meta.url)
// 响应式数据 // 响应式数据
const rowHeight = ref(0) const rowHeight = ref(0)
const rowWidth = ref(0) const rowWidth = ref(0)
@@ -111,7 +111,7 @@ const registerComponent = (path: string): Component | string | null => {
try { try {
// 动态导入组件 // 动态导入组件
const modules = import.meta.glob('@/views/**/*.vue') const modules = import.meta.glob('@/**/*.vue')
if (!modules[path]) { if (!modules[path]) {
console.error(`组件加载失败: ${path}`) console.error(`组件加载失败: ${path}`)
return null return null

View File

@@ -2,7 +2,7 @@
<div class="pd10"> <div class="pd10">
<el-card> <el-card>
<el-form ref="formRef" inline :rules="rules" :model="form" label-width="120px" class="form-four"> <el-form ref="formRef" inline :rules="rules" :model="form" label-width="120px" class="form-four">
<el-form-item label="页面名称:" prop="pageName"> <el-form-item label="页面名称" prop="pageName">
<el-input <el-input
maxlength="32" maxlength="32"
show-word-limit show-word-limit
@@ -11,7 +11,7 @@
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="页面排序:" prop="sort"> <el-form-item label="页面排序" prop="sort">
<el-input <el-input
maxlength="32" maxlength="32"
show-word-limit-number show-word-limit-number
@@ -23,7 +23,7 @@
/> />
</el-form-item> </el-form-item>
<el-form-item label="备注:" class="top"> <el-form-item label="备注" class="top">
<el-input <el-input
maxlength="300" maxlength="300"
show-word-limit show-word-limit
@@ -118,7 +118,7 @@
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, onMounted,onBeforeUnmount } from 'vue' import { ref, reactive, onMounted, onBeforeUnmount } from 'vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import BackComponent from '@/components/icon/back/index.vue' import BackComponent from '@/components/icon/back/index.vue'
import { mainHeight } from '@/utils/layout' import { mainHeight } from '@/utils/layout'
@@ -131,6 +131,9 @@ import { Tools, CloseBold } from '@element-plus/icons-vue'
import { addDashboard, updateDashboard, queryById } from '@/api/system-boot/csstatisticalset' import { addDashboard, updateDashboard, queryById } from '@/api/system-boot/csstatisticalset'
import html2canvas from 'html2canvas' import html2canvas from 'html2canvas'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
// defineOptions({
// name: 'cockpit/popup'
// })
const { go } = useRouter() const { go } = useRouter()
const { query } = useRoute() const { query } = useRoute()
const height = mainHeight(108) const height = mainHeight(108)

View File

@@ -1,9 +1,19 @@
<template> <template>
<div class="default-main"> <div class="default-main">
<div class=" layoutHeader"> <!-- <div class=" layoutHeader">
<div class="title">{{title}}</div> <div class="title">{{title}}</div>
<back-component /> <back-component />
</div> </div> -->
<TableHeader :showSearch="false">
<template v-slot:select>
<el-form-item label="日期">
<DatePicker ref="datePickerRef" :nextFlag="false" :theCurrentTime="true"></DatePicker>
</el-form-item>
</template>
<template v-slot:operation>
<back-component />
</template>
</TableHeader>
<GridLayout <GridLayout
v-model:layout="layout" v-model:layout="layout"
:row-height="rowHeight" :row-height="rowHeight"
@@ -30,8 +40,9 @@
v-if="item.component" v-if="item.component"
class="pd10" class="pd10"
:key="key" :key="key"
:height="rowHeight * item.h - (item.h == 6 ? -20 : item.h == 2 ? 20 : 5) + 'px'" :timeValue="datePickerRef.timeValue"
:width="rowWidth * item.w - 5 + 'px'" :height="rowHeight * item.h - seRowHeight(item.h) + 'px'"
:width="rowWidth * item.w - 30 + 'px'"
:timeKey="item.timeKey" :timeKey="item.timeKey"
/> />
<div v-else class="pd10">组件加载失败...</div> <div v-else class="pd10">组件加载失败...</div>
@@ -47,12 +58,14 @@ import { ref, reactive, onMounted, markRaw, onUnmounted, defineAsyncComponent, t
import { GridLayout } from 'grid-layout-plus' import { GridLayout } from 'grid-layout-plus'
import { useDebounceFn } from '@vueuse/core' import { useDebounceFn } from '@vueuse/core'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import TableHeader from '@/components/table/header/index.vue'
import DatePicker from '@/components/form/datePicker/index.vue'
import BackComponent from '@/components/icon/back/index.vue' import BackComponent from '@/components/icon/back/index.vue'
import { queryById } from '@/api/system-boot/csstatisticalset' import { queryById } from '@/api/system-boot/csstatisticalset'
import { HelpFilled, FullScreen } from '@element-plus/icons-vue' import { HelpFilled, FullScreen } from '@element-plus/icons-vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
// defineOptions({ // defineOptions({
// name: 'cockpit/homePage' // name: 'cockpit/view'
// }) // })
const { query } = useRoute() const { query } = useRoute()
// 定义类型 // 定义类型
@@ -68,14 +81,15 @@ interface LayoutItem {
loading?: boolean loading?: boolean
error?: any error?: any
} }
const datePickerRef = ref()
const title = ref('') const title = ref('')
const key = ref(0) const key = ref(0)
const img = new URL(`@/assets/imgs/amplify.png`, import.meta.url) const img = new URL(`@/assets/img/amplify.png`, import.meta.url)
const img1 = new URL(`@/assets/imgs/reduce.png`, import.meta.url) const img1 = new URL(`@/assets/img/reduce.png`, import.meta.url)
// 响应式数据 // 响应式数据
const rowHeight = ref(0) const rowHeight = ref(0)
const rowWidth = ref(0) const rowWidth = ref(0)
const layout = ref<LayoutItem[]>([ const layout: any = ref<LayoutItem[]>([
// { // {
// x: 4, // x: 4,
// y: 0, // y: 0,
@@ -121,7 +135,7 @@ const registerComponent = (path: string): Component | string | null => {
try { try {
// 动态导入组件 // 动态导入组件
const modules = import.meta.glob('@/views/**/*.vue') const modules = import.meta.glob('@/**/*.vue')
if (!modules[path]) { if (!modules[path]) {
console.error(`组件加载失败: ${path}`) console.error(`组件加载失败: ${path}`)
return null return null
@@ -161,7 +175,7 @@ const zoom = (value: any) => {
const fetchLayoutData = async () => { const fetchLayoutData = async () => {
try { try {
const { data } = await queryById({ id: query.id }) const { data } = await queryById({ id: query.id })
title.value = data.pageName+'_预览' title.value = data.pageName + '_预览'
const parsedLayout = JSON.parse(data.containerConfig || '[]') as LayoutItem[] const parsedLayout = JSON.parse(data.containerConfig || '[]') as LayoutItem[]
// 处理布局数据 // 处理布局数据
layout.value = parsedLayout.map((item, index) => ({ layout.value = parsedLayout.map((item, index) => ({
@@ -175,6 +189,15 @@ const fetchLayoutData = async () => {
// 可以添加错误提示逻辑 // 可以添加错误提示逻辑
} }
} }
const seRowHeight = (value: any) => {
if (value == 6) return 0
if (value == 5) return 12
if (value == 4) return 20
if (value == 3) return 30
if (value == 2) return 40
if (value == 1) return 50
return 0
}
// 窗口大小变化处理 - 使用防抖 // 窗口大小变化处理 - 使用防抖
const handleResize = useDebounceFn(() => { const handleResize = useDebounceFn(() => {
@@ -232,8 +255,10 @@ onUnmounted(() => {
:deep(.vgl-item) { :deep(.vgl-item) {
overflow: hidden; overflow: hidden;
} }
.box { .box {
overflow: hidden; overflow: hidden;
.title { .title {
border-bottom: 1px solid #000; border-bottom: 1px solid #000;
font-size: 14px; font-size: 14px;
@@ -246,6 +271,7 @@ onUnmounted(() => {
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
} }
.HelpFilled { .HelpFilled {
height: 16px; height: 16px;
width: 16px; width: 16px;
@@ -253,13 +279,15 @@ onUnmounted(() => {
margin-right: 5px; margin-right: 5px;
} }
} }
.layoutHeader{
.layoutHeader {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
padding: 10px 20px; padding: 10px 20px;
font-size: 16px; font-size: 16px;
.title{
.title {
font-weight: 600; font-weight: 600;
} }
} }

View File

@@ -1,5 +1,6 @@
<template> <template>
<el-dialog draggable class="cn-operate-dialog" v-model="dialogVisible" width="930px" :title="title" @close="cancel"> <el-dialog draggable class="cn-operate-dialog" v-model="dialogVisible" width="1000px" :title="title"
@close="cancel">
<div style="display: flex"> <div style="display: flex">
<el-form :inline="false" :model="form" label-width="auto" :rules="rules" ref="formRef" style="flex: 1"> <el-form :inline="false" :model="form" label-width="auto" :rules="rules" ref="formRef" style="flex: 1">
<el-form-item class="top" label="组件名称" prop="name"> <el-form-item class="top" label="组件名称" prop="name">
@@ -31,10 +32,10 @@
<el-input v-model="form.sort" placeholder="请输入组件排序"></el-input> <el-input v-model="form.sort" placeholder="请输入组件排序"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div style="width: 550px; height: 370px; overflow: hidden"> <div style="width: 600px; height: 360px; overflow: hidden">
<div class="ml10" style="font-weight: 600">组件展示</div> <div class="ml10" style="font-weight: 600">组件展示</div>
<component :is="registerComponent(form.path)" v-if="registerComponent(form.path)" <component :is="registerComponent(form.path)" v-if="registerComponent(form.path)"
class="pd10 GridLayout" :key="form.path" :height="'350px'" :width="'533px'" class="pd10 GridLayout" :key="form.path" :height="'350px'" :width="'580px'"
:timeKey="form.timeKey" /> :timeKey="form.timeKey" />
<!-- <div class="pd10">组件加载失败...</div> --> <!-- <div class="pd10">组件加载失败...</div> -->
<el-empty v-else description="未查询到组件" style="height: 350px; width: 533px" /> <el-empty v-else description="未查询到组件" style="height: 350px; width: 533px" />
@@ -57,6 +58,7 @@ import TableStore from '@/utils/tableStore' // 若不是列表页面弹框可删
import { getFatherComponent, componentAdd, componentEdit } from '@/api/user-boot/dept' import { getFatherComponent, componentAdd, componentEdit } from '@/api/user-boot/dept'
import IconSelector from '@/components/baInput/components/iconSelector.vue' import IconSelector from '@/components/baInput/components/iconSelector.vue'
import html2canvas from 'html2canvas' import html2canvas from 'html2canvas'
const dictData = useDictData() const dictData = useDictData()
const dialogVisible = ref(false) const dialogVisible = ref(false)
const title = ref('') const title = ref('')
@@ -104,11 +106,12 @@ const submit = () => {
formRef.value.validate(async (valid: boolean) => { formRef.value.validate(async (valid: boolean) => {
if (valid) { if (valid) {
let url = '' let url = ''
await html2canvas(document.querySelector('.GridLayout'), { await html2canvas(document.querySelector('.GridLayout'), {
scale: 2 scale: 2
}).then(canvas => { }).then(canvas => {
url = canvas.toDataURL('image/png') url = canvas.toDataURL('image/png')
console.log('🚀 ~ html2canvas ~ url:', url)
}) })
if (title.value == '新增组件') { if (title.value == '新增组件') {
await componentAdd({ await componentAdd({
@@ -150,7 +153,7 @@ const registerComponent = (path: string): Component | string | null => {
try { try {
// 动态导入组件 // 动态导入组件
const modules = import.meta.glob('@/views/**/*.vue') const modules = import.meta.glob('@/**/*.vue')
if (!modules[path]) { if (!modules[path]) {
console.error(`组件加载失败: ${path}`) console.error(`组件加载失败: ${path}`)
return null return null

View File

@@ -5,16 +5,13 @@
<el-button type="primary" @click="add" icon="el-icon-Plus">新增</el-button> <el-button type="primary" @click="add" icon="el-icon-Plus">新增</el-button>
</template> </template>
</TableHeader> </TableHeader>
<Table <Table ref="tableRef" :tree-config="{ transform: true, parentField: 'uPid', rowField: 'uId' }"
ref="tableRef" :scroll-y="{ enabled: true }" />
:tree-config="{ transform: true, parentField: 'uPid', rowField: 'uId' }"
:scroll-y="{ enabled: true }"
/>
<Add ref="addRef" v-if="addFlag" @onSubmit="tableStore.index()" /> <Add ref="addRef" v-if="addFlag" @onSubmit="tableStore.index()" />
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, provide } from 'vue' import { ref, onMounted, provide,nextTick } from 'vue'
import TableStore from '@/utils/tableStore' import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue' import Table from '@/components/table/index.vue'
import { useDictData } from '@/stores/dictData' import { useDictData } from '@/stores/dictData'
@@ -42,12 +39,13 @@ const tableStore = new TableStore({
width: '80', width: '80',
render: 'icon' render: 'icon'
}, },
{ field: 'code', title: '组件标识' }, { field: 'code', title: '组件标识', minWidth: '100', },
{ field: 'path', title: '组件路径' }, { field: 'path', title: '组件路径' },
{ field: 'image', title: '组件展示', render: 'image' }, { field: 'image', title: '组件展示', render: 'image' },
{ {
title: '操作', title: '操作',
render: 'buttons', render: 'buttons',
width: '150',
buttons: [ buttons: [
{ {
name: 'edit', name: 'edit',
@@ -93,9 +91,9 @@ const tableStore = new TableStore({
loadCallback: () => { loadCallback: () => {
addFlag.value = false addFlag.value = false
setTimeout(() => { setTimeout(() => {
tableRef.value.getRef().setAllTreeExpand(true) tableRef.value?.getRef()?.setAllTreeExpand(true)
}, 1000) }, 0)
tableStore.table.data.forEach((item:any) => { tableStore.table.data.forEach((item: any) => {
item.state = 0 item.state = 0
}) })
treeData.value = tree2List(tableStore.table.data, Math.random() * 1000) treeData.value = tree2List(tableStore.table.data, Math.random() * 1000)

View File

@@ -1,105 +1,105 @@
<template> <template>
<div class="default-main"> <div class="default-main">
<div class="mb10" style="display: flex; justify-content: flex-end"> <div class="mb10" style="display: flex; justify-content: flex-end">
<el-upload <el-upload
ref="upload" ref="upload"
action="" action=""
:auto-upload="false" :auto-upload="false"
:show-file-list="false" :show-file-list="false"
:limit="1" :limit="1"
:on-change="beforeUpload" :on-change="beforeUpload"
> >
<el-button icon="el-icon-Upload" type="primary" class="mr10">导入excel</el-button> <el-button icon="el-icon-Upload" type="primary" class="mr10">导入excel</el-button>
</el-upload> </el-upload>
<el-button @click="downloadExcel" class="" type="primary" icon="el-icon-Download">导出excel</el-button> <el-button @click="downloadExcel" class="" type="primary" icon="el-icon-Download">导出excel</el-button>
<el-button icon="el-icon-ArrowLeftBold" @click="emit('shutDown')">返回</el-button> <el-button icon="el-icon-Back" @click="emit('shutDown')">返回</el-button>
</div> </div>
<div style="display: flex"> <div style="display: flex">
<div id="luckysheet" :style="{ height: height, flex: 1 }"></div> <div id="luckysheet" :style="{ height: height, flex: 1 }"></div>
</div> </div>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { exportExcel } from './export.js' import { exportExcel } from './export.js'
import { mainHeight } from '@/utils/layout' import { mainHeight } from '@/utils/layout'
import LuckyExcel from 'luckyexcel' import LuckyExcel from 'luckyexcel'
import { ref, onMounted } from 'vue' import { ref, onMounted } from 'vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { viewCustomReportTemplateById } from '@/api/harmonic-boot/luckyexcel' import { viewCustomReportTemplateById } from '@/api/harmonic-boot/luckyexcel'
const emit = defineEmits(['shutDown']) const emit = defineEmits(['shutDown'])
const height = mainHeight(65).height const height = mainHeight(65).height
const options: any = ref({ const options: any = ref({
container: 'luckysheet', container: 'luckysheet',
title: '', // 表 头名 title: '', // 表 头名
lang: 'zh', // 中文 lang: 'zh', // 中文
showtoolbar: false, // 是否显示工具栏 showtoolbar: false, // 是否显示工具栏
showinfobar: false, // 是否显示顶部信息栏 showinfobar: false, // 是否显示顶部信息栏
showsheetbar: true, // 是否显示底部sheet按钮 showsheetbar: true, // 是否显示底部sheet按钮
data: [ data: [
{ {
name: 'Cell', name: 'Cell',
index: 0, index: 0,
defaultRowHeight: 27, defaultRowHeight: 27,
defaultColWidth: 105, defaultColWidth: 105,
chart: [] //图表配置 chart: [] //图表配置
} }
] ]
}) })
// 加载luckysheet // 加载luckysheet
const info = () => { const info = () => {
luckysheet.create(options.value) luckysheet.create(options.value)
} }
//绑定value //绑定value
const setValue = (e: any) => { const setValue = (e: any) => {
let data = luckysheet.getRange() let data = luckysheet.getRange()
luckysheet.setCellValue( luckysheet.setCellValue(
data[0].row[0], data[0].row[0],
data[0].column[0], data[0].column[0],
{ {
v: e[e.length - 1], v: e[e.length - 1],
tr: e tr: e
} }
// checkedNodes[0].data.label // checkedNodes[0].data.label
) )
} }
// 下载表格 // 下载表格
const downloadExcel = () => { const downloadExcel = () => {
exportExcel(luckysheet.getAllSheets(), '报表模板') exportExcel(luckysheet.getAllSheets(), '报表模板')
} }
// 导入 // 导入
const beforeUpload = (file: any) => { const beforeUpload = (file: any) => {
LuckyExcel.transformExcelToLucky(file.raw, function (exportJson: any) { LuckyExcel.transformExcelToLucky(file.raw, function (exportJson: any) {
if (exportJson.sheets == null || exportJson.sheets.length == 0) { if (exportJson.sheets == null || exportJson.sheets.length == 0) {
ElMessage.warning('读取excel文件内容失败,目前只能上传xlsx文件!') ElMessage.warning('读取excel文件内容失败,目前只能上传xlsx文件!')
return return
} }
luckysheet.destroy() luckysheet.destroy()
options.value.title = exportJson.info.name options.value.title = exportJson.info.name
options.value.data = exportJson.sheets options.value.data = exportJson.sheets
luckysheet.create(options.value) luckysheet.create(options.value)
}) })
} }
const open = async (row: any) => { const open = async (row: any) => {
await viewCustomReportTemplateById({ id: row.id }).then((Response:any) => { await viewCustomReportTemplateById({ id: row.id }).then((Response:any) => {
Response.forEach((item: any) => { Response.forEach((item: any) => {
item.celldata.forEach((k: any) => { item.celldata.forEach((k: any) => {
item.data[k.r][k.c].v ? (item.data[k.r][k.c] = k.v ) : '' item.data[k.r][k.c].v ? (item.data[k.r][k.c] = k.v ) : ''
}) })
}) })
options.value.data = Response options.value.data = Response
}) })
info() info()
} }
defineExpose({ open }) defineExpose({ open })
onMounted(() => {}) onMounted(() => {})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
:deep(.el-tab-pane) { :deep(.el-tab-pane) {
padding: 10px; padding: 10px;
} }
</style> </style>

View File

@@ -1,167 +1,167 @@
<template> <template>
<div class="default-main"> <div class="default-main">
<div class="mb10" style="display: flex; justify-content: flex-end"> <div class="mb10" style="display: flex; justify-content: flex-end">
<el-upload <el-upload
ref="upload" ref="upload"
action="" action=""
:auto-upload="false" :auto-upload="false"
:show-file-list="false" :show-file-list="false"
:limit="1" :limit="1"
:on-change="beforeUpload" :on-change="beforeUpload"
> >
<el-button icon="el-icon-Upload" type="primary" class="mr10">导入excel</el-button> <el-button icon="el-icon-Upload" type="primary" class="mr10">导入excel</el-button>
</el-upload> </el-upload>
<el-button @click="downloadExcel" class="" type="primary" icon="el-icon-Download">导出excel</el-button> <el-button @click="downloadExcel" class="" type="primary" icon="el-icon-Download">导出excel</el-button>
<el-button type="primary" icon="el-icon-Check" @click="preservation">保存</el-button> <el-button type="primary" icon="el-icon-Check" @click="preservation">保存</el-button>
<el-button icon="el-icon-ArrowLeftBold" @click="emit('shutDown')">返回</el-button> <el-button icon="el-icon-Back" @click="emit('shutDown')">返回</el-button>
</div> </div>
<div style="display: flex"> <div style="display: flex">
<div id="luckysheet" :style="{ height: height, flex: 1 }"></div> <div id="luckysheet" :style="{ height: height, flex: 1 }"></div>
<bind style="width: 500px" class="ml10" @setValue="setValue" /> <bind style="width: 500px" class="ml10" @setValue="setValue" />
</div> </div>
<!-- 信息框 --> <!-- 信息框 -->
<addForm ref="formFer" @submitForm="submitForm" /> <addForm ref="formFer" @submitForm="submitForm" />
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { exportExcel } from './export.js' import { exportExcel } from './export.js'
import { mainHeight } from '@/utils/layout' import { mainHeight } from '@/utils/layout'
import LuckyExcel from 'luckyexcel' import LuckyExcel from 'luckyexcel'
import { ref, onMounted } from 'vue' import { ref, onMounted } from 'vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { addTemplate, dateTemplateup, viewCustomReportTemplateById } from '@/api/harmonic-boot/luckyexcel' import { addTemplate, dateTemplateup, viewCustomReportTemplateById } from '@/api/harmonic-boot/luckyexcel'
import bind from './bind.vue' import bind from './bind.vue'
import addForm from './form.vue' import addForm from './form.vue'
const emit = defineEmits(['shutDown']) const emit = defineEmits(['shutDown'])
const formFer = ref() const formFer = ref()
const title = ref('') const title = ref('')
const list = ref({}) const list = ref({})
const height = mainHeight(65).height const height = mainHeight(65).height
const options: any = ref({ const options: any = ref({
container: 'luckysheet', container: 'luckysheet',
title: '', // 表 头名 title: '', // 表 头名
lang: 'zh', // 中文 lang: 'zh', // 中文
showtoolbar: true, // 是否显示工具栏 showtoolbar: true, // 是否显示工具栏
showinfobar: false, // 是否显示顶部信息栏 showinfobar: false, // 是否显示顶部信息栏
showsheetbar: true, // 是否显示底部sheet按钮 showsheetbar: true, // 是否显示底部sheet按钮
data: [ data: [
{ {
name: 'Cell', name: 'Cell',
index: 0, index: 0,
defaultRowHeight: 27, defaultRowHeight: 27,
defaultColWidth: 105, defaultColWidth: 105,
chart: [] //图表配置 chart: [] //图表配置
} }
] ]
}) })
// 加载luckysheet // 加载luckysheet
const info = () => { const info = () => {
luckysheet.create(options.value) luckysheet.create(options.value)
} }
//绑定value //绑定value
const setValue = (e: any) => { const setValue = (e: any) => {
let data = luckysheet.getRange() let data = luckysheet.getRange()
luckysheet.setCellValue( luckysheet.setCellValue(
data[0].row[0], data[0].row[0],
data[0].column[0], data[0].column[0],
{ {
v: e[e.length - 1], v: e[e.length - 1],
tr: e tr: e
} }
// checkedNodes[0].data.label // checkedNodes[0].data.label
) )
} }
// 下载表格 // 下载表格
const downloadExcel = () => { const downloadExcel = () => {
exportExcel(luckysheet.getAllSheets(), '报表模板') exportExcel(luckysheet.getAllSheets(), '报表模板')
} }
// 导入 // 导入
const beforeUpload = (file: any) => { const beforeUpload = (file: any) => {
LuckyExcel.transformExcelToLucky(file.raw, function (exportJson: any) { LuckyExcel.transformExcelToLucky(file.raw, function (exportJson: any) {
if (exportJson.sheets == null || exportJson.sheets.length == 0) { if (exportJson.sheets == null || exportJson.sheets.length == 0) {
ElMessage.warning('读取excel文件内容失败,目前只能上传xlsx文件!') ElMessage.warning('读取excel文件内容失败,目前只能上传xlsx文件!')
return return
} }
luckysheet.destroy() luckysheet.destroy()
options.value.title = exportJson.info.name options.value.title = exportJson.info.name
// console.log('🚀 ~ exportJson.sheets:', exportJson.sheets) // console.log('🚀 ~ exportJson.sheets:', exportJson.sheets)
exportJson.sheets.forEach((item: any) => { exportJson.sheets.forEach((item: any) => {
// item.celldata = [] // item.celldata = []
// item.data = [] // item.data = []
item.celldata.forEach((k: any) => { item.celldata.forEach((k: any) => {
k.v.ct.s ? (k.v.v = k.v.ct.s[0].v) : '' k.v.ct.s ? (k.v.v = k.v.ct.s[0].v) : ''
k.v.ct.s ? (k.v.m = k.v.ct.s[0].v) : '' k.v.ct.s ? (k.v.m = k.v.ct.s[0].v) : ''
}) })
}) })
options.value.data = exportJson.sheets options.value.data = exportJson.sheets
luckysheet.create(options.value) luckysheet.create(options.value)
}) })
} }
// 保存 // 保存
const preservation = () => { const preservation = () => {
formFer.value.open(title.value, list.value) formFer.value.open(title.value, list.value)
} }
// 新增 // 新增
const submitForm = (formdata: any, text: string) => { const submitForm = (formdata: any, text: string) => {
// let userStr = JSON.stringify(luckysheet.getAllSheets()) // let userStr = JSON.stringify(luckysheet.getAllSheets())
let userStr = luckysheet.getAllSheets() let userStr = luckysheet.getAllSheets()
// console.log('🚀 ~ submitForm ~ userStr:', userStr) // console.log('🚀 ~ submitForm ~ userStr:', userStr)
userStr.forEach((item: any) => { userStr.forEach((item: any) => {
item.data1 = JSON.stringify(item.data) item.data1 = JSON.stringify(item.data)
}) })
let blob = new Blob([JSON.stringify(userStr)], { let blob = new Blob([JSON.stringify(userStr)], {
type: 'application/json;charset=UTF-8' type: 'application/json;charset=UTF-8'
}) })
let files = new window.File([blob], 'content.json', { let files = new window.File([blob], 'content.json', {
type: 'application/json;charset=UTF-8' type: 'application/json;charset=UTF-8'
}) })
let params = new FormData() let params = new FormData()
params.append('fileContent', files) params.append('fileContent', files)
params.append('deptId', formdata.deptId) params.append('deptId', formdata.deptId)
params.append('valueTitle', formdata.deptId) params.append('valueTitle', formdata.deptId)
params.append('name', formdata.name) params.append('name', formdata.name)
params.append('reportType', formdata.reportType) params.append('reportType', formdata.reportType)
params.append('reportForm', formdata.reportForm) params.append('reportForm', formdata.reportForm)
ElMessage.info('正在保存请稍等!') ElMessage.info('正在保存请稍等!')
if (text == '新增报表模板') { if (text == '新增报表模板') {
addTemplate(params).then(res => { addTemplate(params).then(res => {
ElMessage.success('新增成功!') ElMessage.success('新增成功!')
formFer.value.shutDown() formFer.value.shutDown()
emit('shutDown') emit('shutDown')
}).catch(err => { }).catch(err => {
ElMessage.error('保存失败!') ElMessage.error('保存失败!')
formFer.value.shutDown() formFer.value.shutDown()
}) })
} else if (text == '编辑报表模板') { } else if (text == '编辑报表模板') {
params.append('id', list.value.id) params.append('id', list.value.id)
dateTemplateup(params).then(res => { dateTemplateup(params).then(res => {
ElMessage.success('编辑成功!') ElMessage.success('编辑成功!')
formFer.value.shutDown() formFer.value.shutDown()
emit('shutDown') emit('shutDown')
}).catch(err => { }).catch(err => {
ElMessage.error('保存失败!') ElMessage.error('保存失败!')
formFer.value.shutDown() formFer.value.shutDown()
}) })
} }
} }
const open = async (text: string, row?: any) => { const open = async (text: string, row?: any) => {
title.value = text title.value = text
if (row) { if (row) {
list.value = row list.value = row
await viewCustomReportTemplateById({ id: row.id }).then(Response => { await viewCustomReportTemplateById({ id: row.id }).then(Response => {
options.value.data = Response options.value.data = Response
}) })
} }
info() info()
} }
defineExpose({ open }) defineExpose({ open })
onMounted(() => {}) onMounted(() => {})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
:deep(.el-tab-pane) { :deep(.el-tab-pane) {
padding: 10px; padding: 10px;
} }
</style> </style>