diff --git a/src/api/device/standard.ts b/src/api/device/standard.ts index 6a6d694..4f0d99c 100644 --- a/src/api/device/standard.ts +++ b/src/api/device/standard.ts @@ -27,3 +27,31 @@ data, }) } + +// 详情信息 +export function getStandardListDetail(data: object) { + return request({ + url: `${prefix}/standard/detail`, + method: 'post', + data, + }) +} + +// 更新信息 +export function getStandardLisUpdate(data: object) { + return request({ + url: `${prefix}/standard/update`, + method: 'post', + data, + }) +} + +// 获取部门信息 +export function getUsersDept(data: object) { + return request({ + url: `/meter/organize/listPage?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} + diff --git a/src/api/device/standard.ts b/src/api/device/standard.ts index 6a6d694..4f0d99c 100644 --- a/src/api/device/standard.ts +++ b/src/api/device/standard.ts @@ -27,3 +27,31 @@ data, }) } + +// 详情信息 +export function getStandardListDetail(data: object) { + return request({ + url: `${prefix}/standard/detail`, + method: 'post', + data, + }) +} + +// 更新信息 +export function getStandardLisUpdate(data: object) { + return request({ + url: `${prefix}/standard/update`, + method: 'post', + data, + }) +} + +// 获取部门信息 +export function getUsersDept(data: object) { + return request({ + url: `/meter/organize/listPage?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} + diff --git a/src/components.d.ts b/src/components.d.ts index 0bb0edd..f202da8 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -14,11 +14,11 @@ Auth: typeof import('./components/Auth/index.vue')['default'] AuthAll: typeof import('./components/AuthAll/index.vue')['default'] BatchActionBar: typeof import('./components/BatchActionBar/index.vue')['default'] + BenchCol: typeof import('./components/benchCol/index.vue')['default'] ConditionDrawer: typeof import('./components/drawer/conditionDrawer.vue')['default'] CopyerDrawer: typeof import('./components/drawer/copyerDrawer.vue')['default'] Copyright: typeof import('./components/Copyright/index.vue')['default'] DeptSelect: typeof import('./components/DeptSelect/index.vue')['default'] - Echart: typeof import('./components/Echart/index.vue')['default'] Echarts: typeof import('./components/echarts/index.vue')['default'] Editor: typeof import('./components/Editor/index.vue')['default'] EmployeesDialog: typeof import('./components/dialog/employeesDialog.vue')['default'] @@ -29,6 +29,7 @@ ImagePreview: typeof import('./components/ImagePreview/index.vue')['default'] ImagesUpload: typeof import('./components/ImagesUpload/index.vue')['default'] ImageUpload: typeof import('./components/ImageUpload/index.vue')['default'] + LineChart: typeof import('./components/Echart/LineChart.vue')['default'] NodeWrap: typeof import('./components/workFlow/nodeWrap.vue')['default'] NodeWrapBan: typeof import('./components/workFlow/nodeWrapBan.vue')['default'] NormalTable: typeof import('./components/NormalTable/index.vue')['default'] @@ -36,6 +37,7 @@ PageMain: typeof import('./components/PageMain/index.vue')['default'] PcasCascader: typeof import('./components/PcasCascader/index.vue')['default'] Pie: typeof import('./components/echarts/pie.vue')['default'] + PieChart: typeof import('./components/Echart/PieChart.vue')['default'] PromoterDrawer: typeof import('./components/drawer/promoterDrawer.vue')['default'] RoleDialog: typeof import('./components/dialog/roleDialog.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] diff --git a/src/api/device/standard.ts b/src/api/device/standard.ts index 6a6d694..4f0d99c 100644 --- a/src/api/device/standard.ts +++ b/src/api/device/standard.ts @@ -27,3 +27,31 @@ data, }) } + +// 详情信息 +export function getStandardListDetail(data: object) { + return request({ + url: `${prefix}/standard/detail`, + method: 'post', + data, + }) +} + +// 更新信息 +export function getStandardLisUpdate(data: object) { + return request({ + url: `${prefix}/standard/update`, + method: 'post', + data, + }) +} + +// 获取部门信息 +export function getUsersDept(data: object) { + return request({ + url: `/meter/organize/listPage?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} + diff --git a/src/components.d.ts b/src/components.d.ts index 0bb0edd..f202da8 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -14,11 +14,11 @@ Auth: typeof import('./components/Auth/index.vue')['default'] AuthAll: typeof import('./components/AuthAll/index.vue')['default'] BatchActionBar: typeof import('./components/BatchActionBar/index.vue')['default'] + BenchCol: typeof import('./components/benchCol/index.vue')['default'] ConditionDrawer: typeof import('./components/drawer/conditionDrawer.vue')['default'] CopyerDrawer: typeof import('./components/drawer/copyerDrawer.vue')['default'] Copyright: typeof import('./components/Copyright/index.vue')['default'] DeptSelect: typeof import('./components/DeptSelect/index.vue')['default'] - Echart: typeof import('./components/Echart/index.vue')['default'] Echarts: typeof import('./components/echarts/index.vue')['default'] Editor: typeof import('./components/Editor/index.vue')['default'] EmployeesDialog: typeof import('./components/dialog/employeesDialog.vue')['default'] @@ -29,6 +29,7 @@ ImagePreview: typeof import('./components/ImagePreview/index.vue')['default'] ImagesUpload: typeof import('./components/ImagesUpload/index.vue')['default'] ImageUpload: typeof import('./components/ImageUpload/index.vue')['default'] + LineChart: typeof import('./components/Echart/LineChart.vue')['default'] NodeWrap: typeof import('./components/workFlow/nodeWrap.vue')['default'] NodeWrapBan: typeof import('./components/workFlow/nodeWrapBan.vue')['default'] NormalTable: typeof import('./components/NormalTable/index.vue')['default'] @@ -36,6 +37,7 @@ PageMain: typeof import('./components/PageMain/index.vue')['default'] PcasCascader: typeof import('./components/PcasCascader/index.vue')['default'] Pie: typeof import('./components/echarts/pie.vue')['default'] + PieChart: typeof import('./components/Echart/PieChart.vue')['default'] PromoterDrawer: typeof import('./components/drawer/promoterDrawer.vue')['default'] RoleDialog: typeof import('./components/dialog/roleDialog.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] diff --git a/src/components/Echart/LineChart.vue b/src/components/Echart/LineChart.vue new file mode 100644 index 0000000..3fec782 --- /dev/null +++ b/src/components/Echart/LineChart.vue @@ -0,0 +1,350 @@ + + + + + diff --git a/src/api/device/standard.ts b/src/api/device/standard.ts index 6a6d694..4f0d99c 100644 --- a/src/api/device/standard.ts +++ b/src/api/device/standard.ts @@ -27,3 +27,31 @@ data, }) } + +// 详情信息 +export function getStandardListDetail(data: object) { + return request({ + url: `${prefix}/standard/detail`, + method: 'post', + data, + }) +} + +// 更新信息 +export function getStandardLisUpdate(data: object) { + return request({ + url: `${prefix}/standard/update`, + method: 'post', + data, + }) +} + +// 获取部门信息 +export function getUsersDept(data: object) { + return request({ + url: `/meter/organize/listPage?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} + diff --git a/src/components.d.ts b/src/components.d.ts index 0bb0edd..f202da8 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -14,11 +14,11 @@ Auth: typeof import('./components/Auth/index.vue')['default'] AuthAll: typeof import('./components/AuthAll/index.vue')['default'] BatchActionBar: typeof import('./components/BatchActionBar/index.vue')['default'] + BenchCol: typeof import('./components/benchCol/index.vue')['default'] ConditionDrawer: typeof import('./components/drawer/conditionDrawer.vue')['default'] CopyerDrawer: typeof import('./components/drawer/copyerDrawer.vue')['default'] Copyright: typeof import('./components/Copyright/index.vue')['default'] DeptSelect: typeof import('./components/DeptSelect/index.vue')['default'] - Echart: typeof import('./components/Echart/index.vue')['default'] Echarts: typeof import('./components/echarts/index.vue')['default'] Editor: typeof import('./components/Editor/index.vue')['default'] EmployeesDialog: typeof import('./components/dialog/employeesDialog.vue')['default'] @@ -29,6 +29,7 @@ ImagePreview: typeof import('./components/ImagePreview/index.vue')['default'] ImagesUpload: typeof import('./components/ImagesUpload/index.vue')['default'] ImageUpload: typeof import('./components/ImageUpload/index.vue')['default'] + LineChart: typeof import('./components/Echart/LineChart.vue')['default'] NodeWrap: typeof import('./components/workFlow/nodeWrap.vue')['default'] NodeWrapBan: typeof import('./components/workFlow/nodeWrapBan.vue')['default'] NormalTable: typeof import('./components/NormalTable/index.vue')['default'] @@ -36,6 +37,7 @@ PageMain: typeof import('./components/PageMain/index.vue')['default'] PcasCascader: typeof import('./components/PcasCascader/index.vue')['default'] Pie: typeof import('./components/echarts/pie.vue')['default'] + PieChart: typeof import('./components/Echart/PieChart.vue')['default'] PromoterDrawer: typeof import('./components/drawer/promoterDrawer.vue')['default'] RoleDialog: typeof import('./components/dialog/roleDialog.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] diff --git a/src/components/Echart/LineChart.vue b/src/components/Echart/LineChart.vue new file mode 100644 index 0000000..3fec782 --- /dev/null +++ b/src/components/Echart/LineChart.vue @@ -0,0 +1,350 @@ + + + + + diff --git a/src/components/Echart/PieChart.vue b/src/components/Echart/PieChart.vue new file mode 100644 index 0000000..032ee81 --- /dev/null +++ b/src/components/Echart/PieChart.vue @@ -0,0 +1,270 @@ + + + + + diff --git a/src/api/device/standard.ts b/src/api/device/standard.ts index 6a6d694..4f0d99c 100644 --- a/src/api/device/standard.ts +++ b/src/api/device/standard.ts @@ -27,3 +27,31 @@ data, }) } + +// 详情信息 +export function getStandardListDetail(data: object) { + return request({ + url: `${prefix}/standard/detail`, + method: 'post', + data, + }) +} + +// 更新信息 +export function getStandardLisUpdate(data: object) { + return request({ + url: `${prefix}/standard/update`, + method: 'post', + data, + }) +} + +// 获取部门信息 +export function getUsersDept(data: object) { + return request({ + url: `/meter/organize/listPage?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} + diff --git a/src/components.d.ts b/src/components.d.ts index 0bb0edd..f202da8 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -14,11 +14,11 @@ Auth: typeof import('./components/Auth/index.vue')['default'] AuthAll: typeof import('./components/AuthAll/index.vue')['default'] BatchActionBar: typeof import('./components/BatchActionBar/index.vue')['default'] + BenchCol: typeof import('./components/benchCol/index.vue')['default'] ConditionDrawer: typeof import('./components/drawer/conditionDrawer.vue')['default'] CopyerDrawer: typeof import('./components/drawer/copyerDrawer.vue')['default'] Copyright: typeof import('./components/Copyright/index.vue')['default'] DeptSelect: typeof import('./components/DeptSelect/index.vue')['default'] - Echart: typeof import('./components/Echart/index.vue')['default'] Echarts: typeof import('./components/echarts/index.vue')['default'] Editor: typeof import('./components/Editor/index.vue')['default'] EmployeesDialog: typeof import('./components/dialog/employeesDialog.vue')['default'] @@ -29,6 +29,7 @@ ImagePreview: typeof import('./components/ImagePreview/index.vue')['default'] ImagesUpload: typeof import('./components/ImagesUpload/index.vue')['default'] ImageUpload: typeof import('./components/ImageUpload/index.vue')['default'] + LineChart: typeof import('./components/Echart/LineChart.vue')['default'] NodeWrap: typeof import('./components/workFlow/nodeWrap.vue')['default'] NodeWrapBan: typeof import('./components/workFlow/nodeWrapBan.vue')['default'] NormalTable: typeof import('./components/NormalTable/index.vue')['default'] @@ -36,6 +37,7 @@ PageMain: typeof import('./components/PageMain/index.vue')['default'] PcasCascader: typeof import('./components/PcasCascader/index.vue')['default'] Pie: typeof import('./components/echarts/pie.vue')['default'] + PieChart: typeof import('./components/Echart/PieChart.vue')['default'] PromoterDrawer: typeof import('./components/drawer/promoterDrawer.vue')['default'] RoleDialog: typeof import('./components/dialog/roleDialog.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] diff --git a/src/components/Echart/LineChart.vue b/src/components/Echart/LineChart.vue new file mode 100644 index 0000000..3fec782 --- /dev/null +++ b/src/components/Echart/LineChart.vue @@ -0,0 +1,350 @@ + + + + + diff --git a/src/components/Echart/PieChart.vue b/src/components/Echart/PieChart.vue new file mode 100644 index 0000000..032ee81 --- /dev/null +++ b/src/components/Echart/PieChart.vue @@ -0,0 +1,270 @@ + + + + + diff --git a/src/components/Echart/echart-interface.ts b/src/components/Echart/echart-interface.ts new file mode 100644 index 0000000..e677f65 --- /dev/null +++ b/src/components/Echart/echart-interface.ts @@ -0,0 +1,220 @@ +import type { LinearGradientObject } from 'echarts' +// 折线数据格式 +export interface lineDataI { + name: string // 轴线名称 + data: string[] | number[] // 数值 + color?: string // 颜色 +} + +// 饼图数据格式 +export interface pieDataI { + name: string // 分类名称 + value: number // 分类值 +} +// 标题配置 +export interface titleOption { + title?: { + show?: boolean // 是否显示标题 + left?: number | string // 上边距 + right?: number | string // 右边距 + bottom?: number | string // 下边距 + top?: number | string // 顶部边距 + text: string // 标题 + } +} + +// 网格配置 +export interface gridOption { + grid?: { + show?: boolean // 是否显示直角坐标系网格 + left?: number | string // 上边距 + right?: number | string // 右边距 + bottom?: number | string // 下边距 + top?: number | string // 顶部边距 + containLabel?: boolean // grid区域是否包含坐标轴的刻度标签 + } +} +// 图例 +export interface legendOption { + legend?: { + show?: boolean + icon?: string // 图形样式 + orient?: string // 图例方向 + align?: string // 图例标记和文本的对齐,默认自动 + left?: number | string // 上边距 + right?: number | string // 右边距 + bottom?: number | string // 下边距 + top?: number | string // 顶部边距 + padding?: number | [number, number] | [number, number, number, number] // 内边距 + data?: string[] // 数值 + itemWidth?: number // 图例标记宽 + itemHeight?: number // 图例标记高 + itemStyle?: { // 图例标记样式 + decal?: string // 贴花图案 + } + } +} +// 提示框 +export interface tooltipOption { + tooltip: { + show?: boolean + trigger: 'axis' | 'item' | 'none' // 触发类型 + textStyle: { // 浮层的文本样式 + color?: string // 文字颜色,默认白色 + fontSize?: number // 文字大小, 默认14 + } + axisPointer?: { // 坐标轴指示器 + type: 'cross' | 'line' | 'shadow' | 'none' + label: { + show?: boolean // axisPointer为cross时默认显示,其他默认不显示 + fontSize?: number // 文字大小,默认14 + } + } + formatter?: string + valueFormatter?: (value: number | string) => string // 数值显示部分格式化回调函数 + } +} + +// x轴 +export interface xAxisOption { + type: string // 'category' | 'value' | 'time' | 'log' + name?: string + boundaryGap?: boolean | string[] + data?: Array // 类目数据,在类目轴(type=category)中有效 + axisLine?: { // 坐标轴线 + show?: boolean + lineStyle?: { + color?: string // 轴线的颜色 + width?: number // 轴线宽度,默认1 + } + } + nameTextStyle?: { // 坐标轴名称的文字样式。 + color?: string + fontSize?: number // 默认12 + verticalAlign: 'auto' | 'top' | 'middle' | 'bottom' // 文字垂直对齐方式 + } + axisLabel?: { // 坐标轴刻度标签 + color?: string // X轴名称颜色 + fontSize?: number // + } + splitLine: { // 坐标轴在 grid 区域中的分隔线 + show: boolean + interval?: string | number | ((index: number, value: string) => boolean) // 坐标轴分隔线的显示间隔 + lineStyle?: { + color?: string | Array + type?: string // 'dashed' | 'solid' | 'dotted' + shadowBlur?: number // 图形阴影的模糊大小 + shadowColor?: string // 阴影颜色 + shadowOffsetX?: number // 阴影水平方向的偏移距离 + shadowOffsetY?: number // 阴影垂直方向的偏移距离 + } + opacity?: number // 透明度,默认1 + } +} + +// Y轴 +export interface yAxisOption { + type: string // 'category' | 'value' | 'time' | 'log' + name?: string + boundaryGap?: boolean | string[] + data?: Array // 类目数据,在类目轴(type=category)中有效 + axisLine?: { // 坐标轴线 + show?: boolean + lineStyle?: { + color?: string // 轴线的颜色 + width?: number // 轴线宽度,默认1 + } + } + nameTextStyle?: { // 坐标轴名称的文字样式。 + color?: string + fontSize?: number // 默认12 + verticalAlign: 'auto' | 'top' | 'middle' | 'bottom' // 文字垂直对齐方式 + } + axisLabel?: { // 坐标轴刻度标签 + color?: string // X轴名称颜色 + fontSize?: number // + } + splitLine: { // 坐标轴在 grid 区域中的分隔线 + show?: boolean + interval?: string | number | ((index: number, value: string) => boolean) // 坐标轴分隔线的显示间隔 + lineStyle: { + color?: string | Array + type?: string // 'dashed' | 'solid' | 'dotted' + shadowBlur?: number // 图形阴影的模糊大小 + shadowColor?: string // 阴影颜色 + shadowOffsetX?: number // 阴影水平方向的偏移距离 + shadowOffsetY?: number // 阴影垂直方向的偏移距离 + } + opacity?: number // 透明度,默认1 + } +} + +// 折线series配置项 +export interface lineSeriesOption { + name?: string // 系列名称 + type: 'line' + symbol?: string | Function // 标记的图形 'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow', 'none' + smooth?: boolean // 曲线平滑设置, 默认false + itemStyle?: { // 折线拐点样式 + color?: string // 图形的颜色 + borderColor?: string // 图形的描边颜色 + borderWidth?: number // 描边线宽。默认0,无描边。 + shadowBlur?: number // 图形阴影的模糊大小 + shadowColor?: string // 阴影颜色 + shadowOffsetX?: number // 阴影水平方向的偏移距离 + shadowOffsetY?: number // 阴影垂直方向的偏移距离 + } + lineStyle?: { // 线条样式 + width: number // 线条宽度,默认2 + color?: string // 线条颜色, 默认#000 + type?: 'solid' | 'dashed' | 'dotted' // 默认solid + } + areaStyle?: { // 区域填充样式 + color?: string | LinearGradientObject // 填充颜色 + } + data: number[] | string[] +} +// 饼图series配置项 +export interface pieSeriesOption { + name?: string // 系列名称 + type: 'pie' + animationType?: string// 沿圆弧展开效果 expansion|scale + avoidLabelOverlap?: boolean // 是否启用防止标签重叠策略 + roseType?: string | boolean // 玫瑰图类型 + radius?: string[] // 饼图的半径[内半径,外半径] + center?: [string, string] // 圆心坐标[横坐标,纵坐标] + startAngle?: number // 开始的角度 //起始角度,支持范围[0, 360]。 + label?: { // 饼图图形上的文本标签 + show?: boolean // 是否显示 + position?: string // 标签位置 + fontSize?: number // 文字大小,默认12 + fontWeight?: string // 文字粗细 + lineHeight?: number // 行高 + formatter?: string | Function // 标签内容格式器 + rich?: object // 富文本样式 + emphasis?: { // 高亮状态的扇区和标签样式 + show?: boolean + textStyle: { + color?: string + fontSize?: number + fontWeight?: string + } + } + } + labelLine?: { // 视觉引导线 + show?: boolean + } + data: pieDataI[] +} +// 折线图配置项 +export interface lineOption extends titleOption, gridOption, legendOption, tooltipOption { + xAxis: xAxisOption | xAxisOption[] + yAxis: yAxisOption | yAxisOption[] + series: lineSeriesOption[] +} +// 饼图配置项 +export interface pieOption extends titleOption, gridOption, legendOption, tooltipOption { + color?: string[] + series: pieSeriesOption[] +} + diff --git a/src/api/device/standard.ts b/src/api/device/standard.ts index 6a6d694..4f0d99c 100644 --- a/src/api/device/standard.ts +++ b/src/api/device/standard.ts @@ -27,3 +27,31 @@ data, }) } + +// 详情信息 +export function getStandardListDetail(data: object) { + return request({ + url: `${prefix}/standard/detail`, + method: 'post', + data, + }) +} + +// 更新信息 +export function getStandardLisUpdate(data: object) { + return request({ + url: `${prefix}/standard/update`, + method: 'post', + data, + }) +} + +// 获取部门信息 +export function getUsersDept(data: object) { + return request({ + url: `/meter/organize/listPage?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} + diff --git a/src/components.d.ts b/src/components.d.ts index 0bb0edd..f202da8 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -14,11 +14,11 @@ Auth: typeof import('./components/Auth/index.vue')['default'] AuthAll: typeof import('./components/AuthAll/index.vue')['default'] BatchActionBar: typeof import('./components/BatchActionBar/index.vue')['default'] + BenchCol: typeof import('./components/benchCol/index.vue')['default'] ConditionDrawer: typeof import('./components/drawer/conditionDrawer.vue')['default'] CopyerDrawer: typeof import('./components/drawer/copyerDrawer.vue')['default'] Copyright: typeof import('./components/Copyright/index.vue')['default'] DeptSelect: typeof import('./components/DeptSelect/index.vue')['default'] - Echart: typeof import('./components/Echart/index.vue')['default'] Echarts: typeof import('./components/echarts/index.vue')['default'] Editor: typeof import('./components/Editor/index.vue')['default'] EmployeesDialog: typeof import('./components/dialog/employeesDialog.vue')['default'] @@ -29,6 +29,7 @@ ImagePreview: typeof import('./components/ImagePreview/index.vue')['default'] ImagesUpload: typeof import('./components/ImagesUpload/index.vue')['default'] ImageUpload: typeof import('./components/ImageUpload/index.vue')['default'] + LineChart: typeof import('./components/Echart/LineChart.vue')['default'] NodeWrap: typeof import('./components/workFlow/nodeWrap.vue')['default'] NodeWrapBan: typeof import('./components/workFlow/nodeWrapBan.vue')['default'] NormalTable: typeof import('./components/NormalTable/index.vue')['default'] @@ -36,6 +37,7 @@ PageMain: typeof import('./components/PageMain/index.vue')['default'] PcasCascader: typeof import('./components/PcasCascader/index.vue')['default'] Pie: typeof import('./components/echarts/pie.vue')['default'] + PieChart: typeof import('./components/Echart/PieChart.vue')['default'] PromoterDrawer: typeof import('./components/drawer/promoterDrawer.vue')['default'] RoleDialog: typeof import('./components/dialog/roleDialog.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] diff --git a/src/components/Echart/LineChart.vue b/src/components/Echart/LineChart.vue new file mode 100644 index 0000000..3fec782 --- /dev/null +++ b/src/components/Echart/LineChart.vue @@ -0,0 +1,350 @@ + + + + + diff --git a/src/components/Echart/PieChart.vue b/src/components/Echart/PieChart.vue new file mode 100644 index 0000000..032ee81 --- /dev/null +++ b/src/components/Echart/PieChart.vue @@ -0,0 +1,270 @@ + + + + + diff --git a/src/components/Echart/echart-interface.ts b/src/components/Echart/echart-interface.ts new file mode 100644 index 0000000..e677f65 --- /dev/null +++ b/src/components/Echart/echart-interface.ts @@ -0,0 +1,220 @@ +import type { LinearGradientObject } from 'echarts' +// 折线数据格式 +export interface lineDataI { + name: string // 轴线名称 + data: string[] | number[] // 数值 + color?: string // 颜色 +} + +// 饼图数据格式 +export interface pieDataI { + name: string // 分类名称 + value: number // 分类值 +} +// 标题配置 +export interface titleOption { + title?: { + show?: boolean // 是否显示标题 + left?: number | string // 上边距 + right?: number | string // 右边距 + bottom?: number | string // 下边距 + top?: number | string // 顶部边距 + text: string // 标题 + } +} + +// 网格配置 +export interface gridOption { + grid?: { + show?: boolean // 是否显示直角坐标系网格 + left?: number | string // 上边距 + right?: number | string // 右边距 + bottom?: number | string // 下边距 + top?: number | string // 顶部边距 + containLabel?: boolean // grid区域是否包含坐标轴的刻度标签 + } +} +// 图例 +export interface legendOption { + legend?: { + show?: boolean + icon?: string // 图形样式 + orient?: string // 图例方向 + align?: string // 图例标记和文本的对齐,默认自动 + left?: number | string // 上边距 + right?: number | string // 右边距 + bottom?: number | string // 下边距 + top?: number | string // 顶部边距 + padding?: number | [number, number] | [number, number, number, number] // 内边距 + data?: string[] // 数值 + itemWidth?: number // 图例标记宽 + itemHeight?: number // 图例标记高 + itemStyle?: { // 图例标记样式 + decal?: string // 贴花图案 + } + } +} +// 提示框 +export interface tooltipOption { + tooltip: { + show?: boolean + trigger: 'axis' | 'item' | 'none' // 触发类型 + textStyle: { // 浮层的文本样式 + color?: string // 文字颜色,默认白色 + fontSize?: number // 文字大小, 默认14 + } + axisPointer?: { // 坐标轴指示器 + type: 'cross' | 'line' | 'shadow' | 'none' + label: { + show?: boolean // axisPointer为cross时默认显示,其他默认不显示 + fontSize?: number // 文字大小,默认14 + } + } + formatter?: string + valueFormatter?: (value: number | string) => string // 数值显示部分格式化回调函数 + } +} + +// x轴 +export interface xAxisOption { + type: string // 'category' | 'value' | 'time' | 'log' + name?: string + boundaryGap?: boolean | string[] + data?: Array // 类目数据,在类目轴(type=category)中有效 + axisLine?: { // 坐标轴线 + show?: boolean + lineStyle?: { + color?: string // 轴线的颜色 + width?: number // 轴线宽度,默认1 + } + } + nameTextStyle?: { // 坐标轴名称的文字样式。 + color?: string + fontSize?: number // 默认12 + verticalAlign: 'auto' | 'top' | 'middle' | 'bottom' // 文字垂直对齐方式 + } + axisLabel?: { // 坐标轴刻度标签 + color?: string // X轴名称颜色 + fontSize?: number // + } + splitLine: { // 坐标轴在 grid 区域中的分隔线 + show: boolean + interval?: string | number | ((index: number, value: string) => boolean) // 坐标轴分隔线的显示间隔 + lineStyle?: { + color?: string | Array + type?: string // 'dashed' | 'solid' | 'dotted' + shadowBlur?: number // 图形阴影的模糊大小 + shadowColor?: string // 阴影颜色 + shadowOffsetX?: number // 阴影水平方向的偏移距离 + shadowOffsetY?: number // 阴影垂直方向的偏移距离 + } + opacity?: number // 透明度,默认1 + } +} + +// Y轴 +export interface yAxisOption { + type: string // 'category' | 'value' | 'time' | 'log' + name?: string + boundaryGap?: boolean | string[] + data?: Array // 类目数据,在类目轴(type=category)中有效 + axisLine?: { // 坐标轴线 + show?: boolean + lineStyle?: { + color?: string // 轴线的颜色 + width?: number // 轴线宽度,默认1 + } + } + nameTextStyle?: { // 坐标轴名称的文字样式。 + color?: string + fontSize?: number // 默认12 + verticalAlign: 'auto' | 'top' | 'middle' | 'bottom' // 文字垂直对齐方式 + } + axisLabel?: { // 坐标轴刻度标签 + color?: string // X轴名称颜色 + fontSize?: number // + } + splitLine: { // 坐标轴在 grid 区域中的分隔线 + show?: boolean + interval?: string | number | ((index: number, value: string) => boolean) // 坐标轴分隔线的显示间隔 + lineStyle: { + color?: string | Array + type?: string // 'dashed' | 'solid' | 'dotted' + shadowBlur?: number // 图形阴影的模糊大小 + shadowColor?: string // 阴影颜色 + shadowOffsetX?: number // 阴影水平方向的偏移距离 + shadowOffsetY?: number // 阴影垂直方向的偏移距离 + } + opacity?: number // 透明度,默认1 + } +} + +// 折线series配置项 +export interface lineSeriesOption { + name?: string // 系列名称 + type: 'line' + symbol?: string | Function // 标记的图形 'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow', 'none' + smooth?: boolean // 曲线平滑设置, 默认false + itemStyle?: { // 折线拐点样式 + color?: string // 图形的颜色 + borderColor?: string // 图形的描边颜色 + borderWidth?: number // 描边线宽。默认0,无描边。 + shadowBlur?: number // 图形阴影的模糊大小 + shadowColor?: string // 阴影颜色 + shadowOffsetX?: number // 阴影水平方向的偏移距离 + shadowOffsetY?: number // 阴影垂直方向的偏移距离 + } + lineStyle?: { // 线条样式 + width: number // 线条宽度,默认2 + color?: string // 线条颜色, 默认#000 + type?: 'solid' | 'dashed' | 'dotted' // 默认solid + } + areaStyle?: { // 区域填充样式 + color?: string | LinearGradientObject // 填充颜色 + } + data: number[] | string[] +} +// 饼图series配置项 +export interface pieSeriesOption { + name?: string // 系列名称 + type: 'pie' + animationType?: string// 沿圆弧展开效果 expansion|scale + avoidLabelOverlap?: boolean // 是否启用防止标签重叠策略 + roseType?: string | boolean // 玫瑰图类型 + radius?: string[] // 饼图的半径[内半径,外半径] + center?: [string, string] // 圆心坐标[横坐标,纵坐标] + startAngle?: number // 开始的角度 //起始角度,支持范围[0, 360]。 + label?: { // 饼图图形上的文本标签 + show?: boolean // 是否显示 + position?: string // 标签位置 + fontSize?: number // 文字大小,默认12 + fontWeight?: string // 文字粗细 + lineHeight?: number // 行高 + formatter?: string | Function // 标签内容格式器 + rich?: object // 富文本样式 + emphasis?: { // 高亮状态的扇区和标签样式 + show?: boolean + textStyle: { + color?: string + fontSize?: number + fontWeight?: string + } + } + } + labelLine?: { // 视觉引导线 + show?: boolean + } + data: pieDataI[] +} +// 折线图配置项 +export interface lineOption extends titleOption, gridOption, legendOption, tooltipOption { + xAxis: xAxisOption | xAxisOption[] + yAxis: yAxisOption | yAxisOption[] + series: lineSeriesOption[] +} +// 饼图配置项 +export interface pieOption extends titleOption, gridOption, legendOption, tooltipOption { + color?: string[] + series: pieSeriesOption[] +} + diff --git a/src/components/Echart/index.vue b/src/components/Echart/index.vue deleted file mode 100644 index 9efe188..0000000 --- a/src/components/Echart/index.vue +++ /dev/null @@ -1,55 +0,0 @@ - - - - - diff --git a/src/api/device/standard.ts b/src/api/device/standard.ts index 6a6d694..4f0d99c 100644 --- a/src/api/device/standard.ts +++ b/src/api/device/standard.ts @@ -27,3 +27,31 @@ data, }) } + +// 详情信息 +export function getStandardListDetail(data: object) { + return request({ + url: `${prefix}/standard/detail`, + method: 'post', + data, + }) +} + +// 更新信息 +export function getStandardLisUpdate(data: object) { + return request({ + url: `${prefix}/standard/update`, + method: 'post', + data, + }) +} + +// 获取部门信息 +export function getUsersDept(data: object) { + return request({ + url: `/meter/organize/listPage?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} + diff --git a/src/components.d.ts b/src/components.d.ts index 0bb0edd..f202da8 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -14,11 +14,11 @@ Auth: typeof import('./components/Auth/index.vue')['default'] AuthAll: typeof import('./components/AuthAll/index.vue')['default'] BatchActionBar: typeof import('./components/BatchActionBar/index.vue')['default'] + BenchCol: typeof import('./components/benchCol/index.vue')['default'] ConditionDrawer: typeof import('./components/drawer/conditionDrawer.vue')['default'] CopyerDrawer: typeof import('./components/drawer/copyerDrawer.vue')['default'] Copyright: typeof import('./components/Copyright/index.vue')['default'] DeptSelect: typeof import('./components/DeptSelect/index.vue')['default'] - Echart: typeof import('./components/Echart/index.vue')['default'] Echarts: typeof import('./components/echarts/index.vue')['default'] Editor: typeof import('./components/Editor/index.vue')['default'] EmployeesDialog: typeof import('./components/dialog/employeesDialog.vue')['default'] @@ -29,6 +29,7 @@ ImagePreview: typeof import('./components/ImagePreview/index.vue')['default'] ImagesUpload: typeof import('./components/ImagesUpload/index.vue')['default'] ImageUpload: typeof import('./components/ImageUpload/index.vue')['default'] + LineChart: typeof import('./components/Echart/LineChart.vue')['default'] NodeWrap: typeof import('./components/workFlow/nodeWrap.vue')['default'] NodeWrapBan: typeof import('./components/workFlow/nodeWrapBan.vue')['default'] NormalTable: typeof import('./components/NormalTable/index.vue')['default'] @@ -36,6 +37,7 @@ PageMain: typeof import('./components/PageMain/index.vue')['default'] PcasCascader: typeof import('./components/PcasCascader/index.vue')['default'] Pie: typeof import('./components/echarts/pie.vue')['default'] + PieChart: typeof import('./components/Echart/PieChart.vue')['default'] PromoterDrawer: typeof import('./components/drawer/promoterDrawer.vue')['default'] RoleDialog: typeof import('./components/dialog/roleDialog.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] diff --git a/src/components/Echart/LineChart.vue b/src/components/Echart/LineChart.vue new file mode 100644 index 0000000..3fec782 --- /dev/null +++ b/src/components/Echart/LineChart.vue @@ -0,0 +1,350 @@ + + + + + diff --git a/src/components/Echart/PieChart.vue b/src/components/Echart/PieChart.vue new file mode 100644 index 0000000..032ee81 --- /dev/null +++ b/src/components/Echart/PieChart.vue @@ -0,0 +1,270 @@ + + + + + diff --git a/src/components/Echart/echart-interface.ts b/src/components/Echart/echart-interface.ts new file mode 100644 index 0000000..e677f65 --- /dev/null +++ b/src/components/Echart/echart-interface.ts @@ -0,0 +1,220 @@ +import type { LinearGradientObject } from 'echarts' +// 折线数据格式 +export interface lineDataI { + name: string // 轴线名称 + data: string[] | number[] // 数值 + color?: string // 颜色 +} + +// 饼图数据格式 +export interface pieDataI { + name: string // 分类名称 + value: number // 分类值 +} +// 标题配置 +export interface titleOption { + title?: { + show?: boolean // 是否显示标题 + left?: number | string // 上边距 + right?: number | string // 右边距 + bottom?: number | string // 下边距 + top?: number | string // 顶部边距 + text: string // 标题 + } +} + +// 网格配置 +export interface gridOption { + grid?: { + show?: boolean // 是否显示直角坐标系网格 + left?: number | string // 上边距 + right?: number | string // 右边距 + bottom?: number | string // 下边距 + top?: number | string // 顶部边距 + containLabel?: boolean // grid区域是否包含坐标轴的刻度标签 + } +} +// 图例 +export interface legendOption { + legend?: { + show?: boolean + icon?: string // 图形样式 + orient?: string // 图例方向 + align?: string // 图例标记和文本的对齐,默认自动 + left?: number | string // 上边距 + right?: number | string // 右边距 + bottom?: number | string // 下边距 + top?: number | string // 顶部边距 + padding?: number | [number, number] | [number, number, number, number] // 内边距 + data?: string[] // 数值 + itemWidth?: number // 图例标记宽 + itemHeight?: number // 图例标记高 + itemStyle?: { // 图例标记样式 + decal?: string // 贴花图案 + } + } +} +// 提示框 +export interface tooltipOption { + tooltip: { + show?: boolean + trigger: 'axis' | 'item' | 'none' // 触发类型 + textStyle: { // 浮层的文本样式 + color?: string // 文字颜色,默认白色 + fontSize?: number // 文字大小, 默认14 + } + axisPointer?: { // 坐标轴指示器 + type: 'cross' | 'line' | 'shadow' | 'none' + label: { + show?: boolean // axisPointer为cross时默认显示,其他默认不显示 + fontSize?: number // 文字大小,默认14 + } + } + formatter?: string + valueFormatter?: (value: number | string) => string // 数值显示部分格式化回调函数 + } +} + +// x轴 +export interface xAxisOption { + type: string // 'category' | 'value' | 'time' | 'log' + name?: string + boundaryGap?: boolean | string[] + data?: Array // 类目数据,在类目轴(type=category)中有效 + axisLine?: { // 坐标轴线 + show?: boolean + lineStyle?: { + color?: string // 轴线的颜色 + width?: number // 轴线宽度,默认1 + } + } + nameTextStyle?: { // 坐标轴名称的文字样式。 + color?: string + fontSize?: number // 默认12 + verticalAlign: 'auto' | 'top' | 'middle' | 'bottom' // 文字垂直对齐方式 + } + axisLabel?: { // 坐标轴刻度标签 + color?: string // X轴名称颜色 + fontSize?: number // + } + splitLine: { // 坐标轴在 grid 区域中的分隔线 + show: boolean + interval?: string | number | ((index: number, value: string) => boolean) // 坐标轴分隔线的显示间隔 + lineStyle?: { + color?: string | Array + type?: string // 'dashed' | 'solid' | 'dotted' + shadowBlur?: number // 图形阴影的模糊大小 + shadowColor?: string // 阴影颜色 + shadowOffsetX?: number // 阴影水平方向的偏移距离 + shadowOffsetY?: number // 阴影垂直方向的偏移距离 + } + opacity?: number // 透明度,默认1 + } +} + +// Y轴 +export interface yAxisOption { + type: string // 'category' | 'value' | 'time' | 'log' + name?: string + boundaryGap?: boolean | string[] + data?: Array // 类目数据,在类目轴(type=category)中有效 + axisLine?: { // 坐标轴线 + show?: boolean + lineStyle?: { + color?: string // 轴线的颜色 + width?: number // 轴线宽度,默认1 + } + } + nameTextStyle?: { // 坐标轴名称的文字样式。 + color?: string + fontSize?: number // 默认12 + verticalAlign: 'auto' | 'top' | 'middle' | 'bottom' // 文字垂直对齐方式 + } + axisLabel?: { // 坐标轴刻度标签 + color?: string // X轴名称颜色 + fontSize?: number // + } + splitLine: { // 坐标轴在 grid 区域中的分隔线 + show?: boolean + interval?: string | number | ((index: number, value: string) => boolean) // 坐标轴分隔线的显示间隔 + lineStyle: { + color?: string | Array + type?: string // 'dashed' | 'solid' | 'dotted' + shadowBlur?: number // 图形阴影的模糊大小 + shadowColor?: string // 阴影颜色 + shadowOffsetX?: number // 阴影水平方向的偏移距离 + shadowOffsetY?: number // 阴影垂直方向的偏移距离 + } + opacity?: number // 透明度,默认1 + } +} + +// 折线series配置项 +export interface lineSeriesOption { + name?: string // 系列名称 + type: 'line' + symbol?: string | Function // 标记的图形 'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow', 'none' + smooth?: boolean // 曲线平滑设置, 默认false + itemStyle?: { // 折线拐点样式 + color?: string // 图形的颜色 + borderColor?: string // 图形的描边颜色 + borderWidth?: number // 描边线宽。默认0,无描边。 + shadowBlur?: number // 图形阴影的模糊大小 + shadowColor?: string // 阴影颜色 + shadowOffsetX?: number // 阴影水平方向的偏移距离 + shadowOffsetY?: number // 阴影垂直方向的偏移距离 + } + lineStyle?: { // 线条样式 + width: number // 线条宽度,默认2 + color?: string // 线条颜色, 默认#000 + type?: 'solid' | 'dashed' | 'dotted' // 默认solid + } + areaStyle?: { // 区域填充样式 + color?: string | LinearGradientObject // 填充颜色 + } + data: number[] | string[] +} +// 饼图series配置项 +export interface pieSeriesOption { + name?: string // 系列名称 + type: 'pie' + animationType?: string// 沿圆弧展开效果 expansion|scale + avoidLabelOverlap?: boolean // 是否启用防止标签重叠策略 + roseType?: string | boolean // 玫瑰图类型 + radius?: string[] // 饼图的半径[内半径,外半径] + center?: [string, string] // 圆心坐标[横坐标,纵坐标] + startAngle?: number // 开始的角度 //起始角度,支持范围[0, 360]。 + label?: { // 饼图图形上的文本标签 + show?: boolean // 是否显示 + position?: string // 标签位置 + fontSize?: number // 文字大小,默认12 + fontWeight?: string // 文字粗细 + lineHeight?: number // 行高 + formatter?: string | Function // 标签内容格式器 + rich?: object // 富文本样式 + emphasis?: { // 高亮状态的扇区和标签样式 + show?: boolean + textStyle: { + color?: string + fontSize?: number + fontWeight?: string + } + } + } + labelLine?: { // 视觉引导线 + show?: boolean + } + data: pieDataI[] +} +// 折线图配置项 +export interface lineOption extends titleOption, gridOption, legendOption, tooltipOption { + xAxis: xAxisOption | xAxisOption[] + yAxis: yAxisOption | yAxisOption[] + series: lineSeriesOption[] +} +// 饼图配置项 +export interface pieOption extends titleOption, gridOption, legendOption, tooltipOption { + color?: string[] + series: pieSeriesOption[] +} + diff --git a/src/components/Echart/index.vue b/src/components/Echart/index.vue deleted file mode 100644 index 9efe188..0000000 --- a/src/components/Echart/index.vue +++ /dev/null @@ -1,55 +0,0 @@ - - - - - diff --git a/src/components/Echart/theme.json b/src/components/Echart/theme.json index 58a1f46..365f766 100644 --- a/src/components/Echart/theme.json +++ b/src/components/Echart/theme.json @@ -255,7 +255,7 @@ "axisLabel": { "show": true, "textStyle": { - "color": "#fff" + "color": "#222" } }, "splitLine": { @@ -292,7 +292,7 @@ "axisLabel": { "show": true, "textStyle": { - "color": "#fff" + "color": "#333" } }, "splitLine": { @@ -399,7 +399,7 @@ }, "legend": { "textStyle": { - "color": "#fff" + "color": "#333" } }, "tooltip": { diff --git a/src/api/device/standard.ts b/src/api/device/standard.ts index 6a6d694..4f0d99c 100644 --- a/src/api/device/standard.ts +++ b/src/api/device/standard.ts @@ -27,3 +27,31 @@ data, }) } + +// 详情信息 +export function getStandardListDetail(data: object) { + return request({ + url: `${prefix}/standard/detail`, + method: 'post', + data, + }) +} + +// 更新信息 +export function getStandardLisUpdate(data: object) { + return request({ + url: `${prefix}/standard/update`, + method: 'post', + data, + }) +} + +// 获取部门信息 +export function getUsersDept(data: object) { + return request({ + url: `/meter/organize/listPage?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} + diff --git a/src/components.d.ts b/src/components.d.ts index 0bb0edd..f202da8 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -14,11 +14,11 @@ Auth: typeof import('./components/Auth/index.vue')['default'] AuthAll: typeof import('./components/AuthAll/index.vue')['default'] BatchActionBar: typeof import('./components/BatchActionBar/index.vue')['default'] + BenchCol: typeof import('./components/benchCol/index.vue')['default'] ConditionDrawer: typeof import('./components/drawer/conditionDrawer.vue')['default'] CopyerDrawer: typeof import('./components/drawer/copyerDrawer.vue')['default'] Copyright: typeof import('./components/Copyright/index.vue')['default'] DeptSelect: typeof import('./components/DeptSelect/index.vue')['default'] - Echart: typeof import('./components/Echart/index.vue')['default'] Echarts: typeof import('./components/echarts/index.vue')['default'] Editor: typeof import('./components/Editor/index.vue')['default'] EmployeesDialog: typeof import('./components/dialog/employeesDialog.vue')['default'] @@ -29,6 +29,7 @@ ImagePreview: typeof import('./components/ImagePreview/index.vue')['default'] ImagesUpload: typeof import('./components/ImagesUpload/index.vue')['default'] ImageUpload: typeof import('./components/ImageUpload/index.vue')['default'] + LineChart: typeof import('./components/Echart/LineChart.vue')['default'] NodeWrap: typeof import('./components/workFlow/nodeWrap.vue')['default'] NodeWrapBan: typeof import('./components/workFlow/nodeWrapBan.vue')['default'] NormalTable: typeof import('./components/NormalTable/index.vue')['default'] @@ -36,6 +37,7 @@ PageMain: typeof import('./components/PageMain/index.vue')['default'] PcasCascader: typeof import('./components/PcasCascader/index.vue')['default'] Pie: typeof import('./components/echarts/pie.vue')['default'] + PieChart: typeof import('./components/Echart/PieChart.vue')['default'] PromoterDrawer: typeof import('./components/drawer/promoterDrawer.vue')['default'] RoleDialog: typeof import('./components/dialog/roleDialog.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] diff --git a/src/components/Echart/LineChart.vue b/src/components/Echart/LineChart.vue new file mode 100644 index 0000000..3fec782 --- /dev/null +++ b/src/components/Echart/LineChart.vue @@ -0,0 +1,350 @@ + + + + + diff --git a/src/components/Echart/PieChart.vue b/src/components/Echart/PieChart.vue new file mode 100644 index 0000000..032ee81 --- /dev/null +++ b/src/components/Echart/PieChart.vue @@ -0,0 +1,270 @@ + + + + + diff --git a/src/components/Echart/echart-interface.ts b/src/components/Echart/echart-interface.ts new file mode 100644 index 0000000..e677f65 --- /dev/null +++ b/src/components/Echart/echart-interface.ts @@ -0,0 +1,220 @@ +import type { LinearGradientObject } from 'echarts' +// 折线数据格式 +export interface lineDataI { + name: string // 轴线名称 + data: string[] | number[] // 数值 + color?: string // 颜色 +} + +// 饼图数据格式 +export interface pieDataI { + name: string // 分类名称 + value: number // 分类值 +} +// 标题配置 +export interface titleOption { + title?: { + show?: boolean // 是否显示标题 + left?: number | string // 上边距 + right?: number | string // 右边距 + bottom?: number | string // 下边距 + top?: number | string // 顶部边距 + text: string // 标题 + } +} + +// 网格配置 +export interface gridOption { + grid?: { + show?: boolean // 是否显示直角坐标系网格 + left?: number | string // 上边距 + right?: number | string // 右边距 + bottom?: number | string // 下边距 + top?: number | string // 顶部边距 + containLabel?: boolean // grid区域是否包含坐标轴的刻度标签 + } +} +// 图例 +export interface legendOption { + legend?: { + show?: boolean + icon?: string // 图形样式 + orient?: string // 图例方向 + align?: string // 图例标记和文本的对齐,默认自动 + left?: number | string // 上边距 + right?: number | string // 右边距 + bottom?: number | string // 下边距 + top?: number | string // 顶部边距 + padding?: number | [number, number] | [number, number, number, number] // 内边距 + data?: string[] // 数值 + itemWidth?: number // 图例标记宽 + itemHeight?: number // 图例标记高 + itemStyle?: { // 图例标记样式 + decal?: string // 贴花图案 + } + } +} +// 提示框 +export interface tooltipOption { + tooltip: { + show?: boolean + trigger: 'axis' | 'item' | 'none' // 触发类型 + textStyle: { // 浮层的文本样式 + color?: string // 文字颜色,默认白色 + fontSize?: number // 文字大小, 默认14 + } + axisPointer?: { // 坐标轴指示器 + type: 'cross' | 'line' | 'shadow' | 'none' + label: { + show?: boolean // axisPointer为cross时默认显示,其他默认不显示 + fontSize?: number // 文字大小,默认14 + } + } + formatter?: string + valueFormatter?: (value: number | string) => string // 数值显示部分格式化回调函数 + } +} + +// x轴 +export interface xAxisOption { + type: string // 'category' | 'value' | 'time' | 'log' + name?: string + boundaryGap?: boolean | string[] + data?: Array // 类目数据,在类目轴(type=category)中有效 + axisLine?: { // 坐标轴线 + show?: boolean + lineStyle?: { + color?: string // 轴线的颜色 + width?: number // 轴线宽度,默认1 + } + } + nameTextStyle?: { // 坐标轴名称的文字样式。 + color?: string + fontSize?: number // 默认12 + verticalAlign: 'auto' | 'top' | 'middle' | 'bottom' // 文字垂直对齐方式 + } + axisLabel?: { // 坐标轴刻度标签 + color?: string // X轴名称颜色 + fontSize?: number // + } + splitLine: { // 坐标轴在 grid 区域中的分隔线 + show: boolean + interval?: string | number | ((index: number, value: string) => boolean) // 坐标轴分隔线的显示间隔 + lineStyle?: { + color?: string | Array + type?: string // 'dashed' | 'solid' | 'dotted' + shadowBlur?: number // 图形阴影的模糊大小 + shadowColor?: string // 阴影颜色 + shadowOffsetX?: number // 阴影水平方向的偏移距离 + shadowOffsetY?: number // 阴影垂直方向的偏移距离 + } + opacity?: number // 透明度,默认1 + } +} + +// Y轴 +export interface yAxisOption { + type: string // 'category' | 'value' | 'time' | 'log' + name?: string + boundaryGap?: boolean | string[] + data?: Array // 类目数据,在类目轴(type=category)中有效 + axisLine?: { // 坐标轴线 + show?: boolean + lineStyle?: { + color?: string // 轴线的颜色 + width?: number // 轴线宽度,默认1 + } + } + nameTextStyle?: { // 坐标轴名称的文字样式。 + color?: string + fontSize?: number // 默认12 + verticalAlign: 'auto' | 'top' | 'middle' | 'bottom' // 文字垂直对齐方式 + } + axisLabel?: { // 坐标轴刻度标签 + color?: string // X轴名称颜色 + fontSize?: number // + } + splitLine: { // 坐标轴在 grid 区域中的分隔线 + show?: boolean + interval?: string | number | ((index: number, value: string) => boolean) // 坐标轴分隔线的显示间隔 + lineStyle: { + color?: string | Array + type?: string // 'dashed' | 'solid' | 'dotted' + shadowBlur?: number // 图形阴影的模糊大小 + shadowColor?: string // 阴影颜色 + shadowOffsetX?: number // 阴影水平方向的偏移距离 + shadowOffsetY?: number // 阴影垂直方向的偏移距离 + } + opacity?: number // 透明度,默认1 + } +} + +// 折线series配置项 +export interface lineSeriesOption { + name?: string // 系列名称 + type: 'line' + symbol?: string | Function // 标记的图形 'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow', 'none' + smooth?: boolean // 曲线平滑设置, 默认false + itemStyle?: { // 折线拐点样式 + color?: string // 图形的颜色 + borderColor?: string // 图形的描边颜色 + borderWidth?: number // 描边线宽。默认0,无描边。 + shadowBlur?: number // 图形阴影的模糊大小 + shadowColor?: string // 阴影颜色 + shadowOffsetX?: number // 阴影水平方向的偏移距离 + shadowOffsetY?: number // 阴影垂直方向的偏移距离 + } + lineStyle?: { // 线条样式 + width: number // 线条宽度,默认2 + color?: string // 线条颜色, 默认#000 + type?: 'solid' | 'dashed' | 'dotted' // 默认solid + } + areaStyle?: { // 区域填充样式 + color?: string | LinearGradientObject // 填充颜色 + } + data: number[] | string[] +} +// 饼图series配置项 +export interface pieSeriesOption { + name?: string // 系列名称 + type: 'pie' + animationType?: string// 沿圆弧展开效果 expansion|scale + avoidLabelOverlap?: boolean // 是否启用防止标签重叠策略 + roseType?: string | boolean // 玫瑰图类型 + radius?: string[] // 饼图的半径[内半径,外半径] + center?: [string, string] // 圆心坐标[横坐标,纵坐标] + startAngle?: number // 开始的角度 //起始角度,支持范围[0, 360]。 + label?: { // 饼图图形上的文本标签 + show?: boolean // 是否显示 + position?: string // 标签位置 + fontSize?: number // 文字大小,默认12 + fontWeight?: string // 文字粗细 + lineHeight?: number // 行高 + formatter?: string | Function // 标签内容格式器 + rich?: object // 富文本样式 + emphasis?: { // 高亮状态的扇区和标签样式 + show?: boolean + textStyle: { + color?: string + fontSize?: number + fontWeight?: string + } + } + } + labelLine?: { // 视觉引导线 + show?: boolean + } + data: pieDataI[] +} +// 折线图配置项 +export interface lineOption extends titleOption, gridOption, legendOption, tooltipOption { + xAxis: xAxisOption | xAxisOption[] + yAxis: yAxisOption | yAxisOption[] + series: lineSeriesOption[] +} +// 饼图配置项 +export interface pieOption extends titleOption, gridOption, legendOption, tooltipOption { + color?: string[] + series: pieSeriesOption[] +} + diff --git a/src/components/Echart/index.vue b/src/components/Echart/index.vue deleted file mode 100644 index 9efe188..0000000 --- a/src/components/Echart/index.vue +++ /dev/null @@ -1,55 +0,0 @@ - - - - - diff --git a/src/components/Echart/theme.json b/src/components/Echart/theme.json index 58a1f46..365f766 100644 --- a/src/components/Echart/theme.json +++ b/src/components/Echart/theme.json @@ -255,7 +255,7 @@ "axisLabel": { "show": true, "textStyle": { - "color": "#fff" + "color": "#222" } }, "splitLine": { @@ -292,7 +292,7 @@ "axisLabel": { "show": true, "textStyle": { - "color": "#fff" + "color": "#333" } }, "splitLine": { @@ -399,7 +399,7 @@ }, "legend": { "textStyle": { - "color": "#fff" + "color": "#333" } }, "tooltip": { diff --git a/src/components/Echart/utils.ts b/src/components/Echart/utils.ts new file mode 100644 index 0000000..0acd088 --- /dev/null +++ b/src/components/Echart/utils.ts @@ -0,0 +1,38 @@ +/** + * 格式化颜色 + * @param value 颜色值 #aaa格式或rgb格式 + * @returns 颜色值 + */ +export function formatColor(value: string): string { + const rgbReg = /((2[0-4]\\d|25[0-5]|[01]?[0-9]?[0-9]?)[\\s]*,){2}[\\s]*(2[0-4]\\d|25[0-5]|[0-1]?[0-9]?[0-9])$/ + if (value.startsWith('#')) { // #号开头的颜色值 + return value + } + else if (rgbReg.test(value)) { // 数字开头的颜色值 + return `rgb(${value})` + } + else { + return '' + } +} + +/** + * 获取某颜色的透明度颜色 + * @param color 颜色 + * @param alpha 透明度 + * @returns 透明度颜色 + */ +export function getAlphaColor(color: string, alpha: number): string { + const rgbReg = /((2[0-4]\\d|25[0-5]|[01]?[0-9]?[0-9]?)[\\s]*,){2}[\\s]*(2[0-4]\\d|25[0-5]|[0-1]?[0-9]?[0-9])$/ + if (color.startsWith('#')) { // #号开头的颜色值 + let alpha2 = Math.floor(alpha * 255) + alpha2 = alpha > 255 ? 255 : alpha2 + return color + alpha2.toString(16) // 转换为16进制 + } + else if (rgbReg.test(color)) { // 数字开头的颜色值 + return `rgba(${color}, ${alpha})` + } + else { + return '' + } +} diff --git a/src/api/device/standard.ts b/src/api/device/standard.ts index 6a6d694..4f0d99c 100644 --- a/src/api/device/standard.ts +++ b/src/api/device/standard.ts @@ -27,3 +27,31 @@ data, }) } + +// 详情信息 +export function getStandardListDetail(data: object) { + return request({ + url: `${prefix}/standard/detail`, + method: 'post', + data, + }) +} + +// 更新信息 +export function getStandardLisUpdate(data: object) { + return request({ + url: `${prefix}/standard/update`, + method: 'post', + data, + }) +} + +// 获取部门信息 +export function getUsersDept(data: object) { + return request({ + url: `/meter/organize/listPage?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} + diff --git a/src/components.d.ts b/src/components.d.ts index 0bb0edd..f202da8 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -14,11 +14,11 @@ Auth: typeof import('./components/Auth/index.vue')['default'] AuthAll: typeof import('./components/AuthAll/index.vue')['default'] BatchActionBar: typeof import('./components/BatchActionBar/index.vue')['default'] + BenchCol: typeof import('./components/benchCol/index.vue')['default'] ConditionDrawer: typeof import('./components/drawer/conditionDrawer.vue')['default'] CopyerDrawer: typeof import('./components/drawer/copyerDrawer.vue')['default'] Copyright: typeof import('./components/Copyright/index.vue')['default'] DeptSelect: typeof import('./components/DeptSelect/index.vue')['default'] - Echart: typeof import('./components/Echart/index.vue')['default'] Echarts: typeof import('./components/echarts/index.vue')['default'] Editor: typeof import('./components/Editor/index.vue')['default'] EmployeesDialog: typeof import('./components/dialog/employeesDialog.vue')['default'] @@ -29,6 +29,7 @@ ImagePreview: typeof import('./components/ImagePreview/index.vue')['default'] ImagesUpload: typeof import('./components/ImagesUpload/index.vue')['default'] ImageUpload: typeof import('./components/ImageUpload/index.vue')['default'] + LineChart: typeof import('./components/Echart/LineChart.vue')['default'] NodeWrap: typeof import('./components/workFlow/nodeWrap.vue')['default'] NodeWrapBan: typeof import('./components/workFlow/nodeWrapBan.vue')['default'] NormalTable: typeof import('./components/NormalTable/index.vue')['default'] @@ -36,6 +37,7 @@ PageMain: typeof import('./components/PageMain/index.vue')['default'] PcasCascader: typeof import('./components/PcasCascader/index.vue')['default'] Pie: typeof import('./components/echarts/pie.vue')['default'] + PieChart: typeof import('./components/Echart/PieChart.vue')['default'] PromoterDrawer: typeof import('./components/drawer/promoterDrawer.vue')['default'] RoleDialog: typeof import('./components/dialog/roleDialog.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] diff --git a/src/components/Echart/LineChart.vue b/src/components/Echart/LineChart.vue new file mode 100644 index 0000000..3fec782 --- /dev/null +++ b/src/components/Echart/LineChart.vue @@ -0,0 +1,350 @@ + + + + + diff --git a/src/components/Echart/PieChart.vue b/src/components/Echart/PieChart.vue new file mode 100644 index 0000000..032ee81 --- /dev/null +++ b/src/components/Echart/PieChart.vue @@ -0,0 +1,270 @@ + + + + + diff --git a/src/components/Echart/echart-interface.ts b/src/components/Echart/echart-interface.ts new file mode 100644 index 0000000..e677f65 --- /dev/null +++ b/src/components/Echart/echart-interface.ts @@ -0,0 +1,220 @@ +import type { LinearGradientObject } from 'echarts' +// 折线数据格式 +export interface lineDataI { + name: string // 轴线名称 + data: string[] | number[] // 数值 + color?: string // 颜色 +} + +// 饼图数据格式 +export interface pieDataI { + name: string // 分类名称 + value: number // 分类值 +} +// 标题配置 +export interface titleOption { + title?: { + show?: boolean // 是否显示标题 + left?: number | string // 上边距 + right?: number | string // 右边距 + bottom?: number | string // 下边距 + top?: number | string // 顶部边距 + text: string // 标题 + } +} + +// 网格配置 +export interface gridOption { + grid?: { + show?: boolean // 是否显示直角坐标系网格 + left?: number | string // 上边距 + right?: number | string // 右边距 + bottom?: number | string // 下边距 + top?: number | string // 顶部边距 + containLabel?: boolean // grid区域是否包含坐标轴的刻度标签 + } +} +// 图例 +export interface legendOption { + legend?: { + show?: boolean + icon?: string // 图形样式 + orient?: string // 图例方向 + align?: string // 图例标记和文本的对齐,默认自动 + left?: number | string // 上边距 + right?: number | string // 右边距 + bottom?: number | string // 下边距 + top?: number | string // 顶部边距 + padding?: number | [number, number] | [number, number, number, number] // 内边距 + data?: string[] // 数值 + itemWidth?: number // 图例标记宽 + itemHeight?: number // 图例标记高 + itemStyle?: { // 图例标记样式 + decal?: string // 贴花图案 + } + } +} +// 提示框 +export interface tooltipOption { + tooltip: { + show?: boolean + trigger: 'axis' | 'item' | 'none' // 触发类型 + textStyle: { // 浮层的文本样式 + color?: string // 文字颜色,默认白色 + fontSize?: number // 文字大小, 默认14 + } + axisPointer?: { // 坐标轴指示器 + type: 'cross' | 'line' | 'shadow' | 'none' + label: { + show?: boolean // axisPointer为cross时默认显示,其他默认不显示 + fontSize?: number // 文字大小,默认14 + } + } + formatter?: string + valueFormatter?: (value: number | string) => string // 数值显示部分格式化回调函数 + } +} + +// x轴 +export interface xAxisOption { + type: string // 'category' | 'value' | 'time' | 'log' + name?: string + boundaryGap?: boolean | string[] + data?: Array // 类目数据,在类目轴(type=category)中有效 + axisLine?: { // 坐标轴线 + show?: boolean + lineStyle?: { + color?: string // 轴线的颜色 + width?: number // 轴线宽度,默认1 + } + } + nameTextStyle?: { // 坐标轴名称的文字样式。 + color?: string + fontSize?: number // 默认12 + verticalAlign: 'auto' | 'top' | 'middle' | 'bottom' // 文字垂直对齐方式 + } + axisLabel?: { // 坐标轴刻度标签 + color?: string // X轴名称颜色 + fontSize?: number // + } + splitLine: { // 坐标轴在 grid 区域中的分隔线 + show: boolean + interval?: string | number | ((index: number, value: string) => boolean) // 坐标轴分隔线的显示间隔 + lineStyle?: { + color?: string | Array + type?: string // 'dashed' | 'solid' | 'dotted' + shadowBlur?: number // 图形阴影的模糊大小 + shadowColor?: string // 阴影颜色 + shadowOffsetX?: number // 阴影水平方向的偏移距离 + shadowOffsetY?: number // 阴影垂直方向的偏移距离 + } + opacity?: number // 透明度,默认1 + } +} + +// Y轴 +export interface yAxisOption { + type: string // 'category' | 'value' | 'time' | 'log' + name?: string + boundaryGap?: boolean | string[] + data?: Array // 类目数据,在类目轴(type=category)中有效 + axisLine?: { // 坐标轴线 + show?: boolean + lineStyle?: { + color?: string // 轴线的颜色 + width?: number // 轴线宽度,默认1 + } + } + nameTextStyle?: { // 坐标轴名称的文字样式。 + color?: string + fontSize?: number // 默认12 + verticalAlign: 'auto' | 'top' | 'middle' | 'bottom' // 文字垂直对齐方式 + } + axisLabel?: { // 坐标轴刻度标签 + color?: string // X轴名称颜色 + fontSize?: number // + } + splitLine: { // 坐标轴在 grid 区域中的分隔线 + show?: boolean + interval?: string | number | ((index: number, value: string) => boolean) // 坐标轴分隔线的显示间隔 + lineStyle: { + color?: string | Array + type?: string // 'dashed' | 'solid' | 'dotted' + shadowBlur?: number // 图形阴影的模糊大小 + shadowColor?: string // 阴影颜色 + shadowOffsetX?: number // 阴影水平方向的偏移距离 + shadowOffsetY?: number // 阴影垂直方向的偏移距离 + } + opacity?: number // 透明度,默认1 + } +} + +// 折线series配置项 +export interface lineSeriesOption { + name?: string // 系列名称 + type: 'line' + symbol?: string | Function // 标记的图形 'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow', 'none' + smooth?: boolean // 曲线平滑设置, 默认false + itemStyle?: { // 折线拐点样式 + color?: string // 图形的颜色 + borderColor?: string // 图形的描边颜色 + borderWidth?: number // 描边线宽。默认0,无描边。 + shadowBlur?: number // 图形阴影的模糊大小 + shadowColor?: string // 阴影颜色 + shadowOffsetX?: number // 阴影水平方向的偏移距离 + shadowOffsetY?: number // 阴影垂直方向的偏移距离 + } + lineStyle?: { // 线条样式 + width: number // 线条宽度,默认2 + color?: string // 线条颜色, 默认#000 + type?: 'solid' | 'dashed' | 'dotted' // 默认solid + } + areaStyle?: { // 区域填充样式 + color?: string | LinearGradientObject // 填充颜色 + } + data: number[] | string[] +} +// 饼图series配置项 +export interface pieSeriesOption { + name?: string // 系列名称 + type: 'pie' + animationType?: string// 沿圆弧展开效果 expansion|scale + avoidLabelOverlap?: boolean // 是否启用防止标签重叠策略 + roseType?: string | boolean // 玫瑰图类型 + radius?: string[] // 饼图的半径[内半径,外半径] + center?: [string, string] // 圆心坐标[横坐标,纵坐标] + startAngle?: number // 开始的角度 //起始角度,支持范围[0, 360]。 + label?: { // 饼图图形上的文本标签 + show?: boolean // 是否显示 + position?: string // 标签位置 + fontSize?: number // 文字大小,默认12 + fontWeight?: string // 文字粗细 + lineHeight?: number // 行高 + formatter?: string | Function // 标签内容格式器 + rich?: object // 富文本样式 + emphasis?: { // 高亮状态的扇区和标签样式 + show?: boolean + textStyle: { + color?: string + fontSize?: number + fontWeight?: string + } + } + } + labelLine?: { // 视觉引导线 + show?: boolean + } + data: pieDataI[] +} +// 折线图配置项 +export interface lineOption extends titleOption, gridOption, legendOption, tooltipOption { + xAxis: xAxisOption | xAxisOption[] + yAxis: yAxisOption | yAxisOption[] + series: lineSeriesOption[] +} +// 饼图配置项 +export interface pieOption extends titleOption, gridOption, legendOption, tooltipOption { + color?: string[] + series: pieSeriesOption[] +} + diff --git a/src/components/Echart/index.vue b/src/components/Echart/index.vue deleted file mode 100644 index 9efe188..0000000 --- a/src/components/Echart/index.vue +++ /dev/null @@ -1,55 +0,0 @@ - - - - - diff --git a/src/components/Echart/theme.json b/src/components/Echart/theme.json index 58a1f46..365f766 100644 --- a/src/components/Echart/theme.json +++ b/src/components/Echart/theme.json @@ -255,7 +255,7 @@ "axisLabel": { "show": true, "textStyle": { - "color": "#fff" + "color": "#222" } }, "splitLine": { @@ -292,7 +292,7 @@ "axisLabel": { "show": true, "textStyle": { - "color": "#fff" + "color": "#333" } }, "splitLine": { @@ -399,7 +399,7 @@ }, "legend": { "textStyle": { - "color": "#fff" + "color": "#333" } }, "tooltip": { diff --git a/src/components/Echart/utils.ts b/src/components/Echart/utils.ts new file mode 100644 index 0000000..0acd088 --- /dev/null +++ b/src/components/Echart/utils.ts @@ -0,0 +1,38 @@ +/** + * 格式化颜色 + * @param value 颜色值 #aaa格式或rgb格式 + * @returns 颜色值 + */ +export function formatColor(value: string): string { + const rgbReg = /((2[0-4]\\d|25[0-5]|[01]?[0-9]?[0-9]?)[\\s]*,){2}[\\s]*(2[0-4]\\d|25[0-5]|[0-1]?[0-9]?[0-9])$/ + if (value.startsWith('#')) { // #号开头的颜色值 + return value + } + else if (rgbReg.test(value)) { // 数字开头的颜色值 + return `rgb(${value})` + } + else { + return '' + } +} + +/** + * 获取某颜色的透明度颜色 + * @param color 颜色 + * @param alpha 透明度 + * @returns 透明度颜色 + */ +export function getAlphaColor(color: string, alpha: number): string { + const rgbReg = /((2[0-4]\\d|25[0-5]|[01]?[0-9]?[0-9]?)[\\s]*,){2}[\\s]*(2[0-4]\\d|25[0-5]|[0-1]?[0-9]?[0-9])$/ + if (color.startsWith('#')) { // #号开头的颜色值 + let alpha2 = Math.floor(alpha * 255) + alpha2 = alpha > 255 ? 255 : alpha2 + return color + alpha2.toString(16) // 转换为16进制 + } + else if (rgbReg.test(color)) { // 数字开头的颜色值 + return `rgba(${color}, ${alpha})` + } + else { + return '' + } +} diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 4c53275..2b110cb 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -165,7 +165,7 @@
+import * as echarts from 'echarts/core' +import type { ECharts } from 'echarts' +import { init } from 'echarts' +import type { Ref } from 'vue' +import type { ECBasicOption } from 'echarts/types/dist/shared' +import type { lineDataI, lineOption, lineSeriesOption } from './echart-interface' +import tdTheme from './theme.json' // 引入默认主题 +import { formatColor, getAlphaColor } from './utils' +const props = defineProps({ + /** + * id + */ + id: { + type: String, + default: 'chart', + }, + /** + * 加载状态 + */ + loading: { + type: Boolean, + default: false, + }, + /** + * 网格配置 + */ + grid: { + type: Object, + default: () => { + return { + top: 50, + left: 10, + right: 20, + bottom: 5, + containLabel: true, // 是否包含坐标轴的刻度标签 + } + }, + }, + /** + * 图例设置对象 + */ + legend: { + type: Object, + default: () => { + return { + show: true, + icon: 'circle', + orient: 'vertile', // 图例方向 + align: 'left', // 图例标记和文本的对齐,默认自动 + top: 0, + right: 20, + itemWidth: 12, + itemHeight: 12, + padding: [0, 0, 0, 120], + } + }, + }, + /** + * 图例列表,非必传 + */ + legendData: { + type: Array, + default: () => { return [] }, + }, + /** + * 图表宽 + */ + width: { + type: String, + default: '100%', + }, + /** + * 图表高 + */ + height: { + type: String, + default: '100%', + }, + /** + * X轴刻度数据,格式为['周一','周二'...] + */ + xAxisData: { + type: Array, + default: () => { return [] }, + }, + /** + * X轴类型 + */ + xAxisType: { + type: String, + default: 'category', + validator: (value: string) => { + return ['category', 'value', 'time', 'log'].includes(value) + }, + }, + /** + * 数据,格式为[{name:'系列名',data:[0,0,0,...0], color:'可选'},...] + */ + data: { + type: Array, + default: () => { return [] }, + }, + /** + * 单位 + */ + unit: { + type: String, + default: '', + }, + /** + * 颜色 + */ + colors: { + type: Array, + default: () => { + return [ + '#2d8cf0', + '#19be6b', + '#ff9900', + '#E46CBB', + '#9A66E4', + '#ed3f14', + '#01C2F9', + ] + }, + }, + /** + * 实虚线 + */ + axisLineType: { + type: String, + default: '', + }, + /** + * 轴线颜色 + */ + axisLineColor: { + type: String, + default: '#96989b', + }, + /** + * 轴线上文字颜色 + */ + fontColor: { + type: String, + default: '#000000', + }, + /** + * 是否为渐变折线图 + */ + gradient: { + type: Boolean, + default: true, + }, + /** + * 标题 + */ + title: { + type: String, + default: '', + }, + /** + * 平滑 + */ + smooth: { + type: Boolean, + default: true, + }, +}) + +// 图表对象 +let chart: ECharts +const chartRef: Ref = ref(null) + +// 监听数据变化 +watch( + [() => props.xAxisData, props.data], ([newName, newNums], [oldName, oldNums]) => { + refreshChart() + }, + { + immediate: true, + deep: true, + }, +) +// 构建option +function buildOption() { + const option: lineOption = { + grid: props.grid, + legend: props.legend, // 图例 + tooltip: { + trigger: 'axis', + textStyle: { + fontSize: 16, + }, + axisPointer: { + type: 'cross', + label: { + fontSize: 13, + }, + }, + valueFormatter: (value: string | number) => { + return value ? value + props.unit : '' + }, + }, // 提示框 + xAxis: [ + { + type: props.xAxisType, + boundaryGap: true, + axisLine: { + lineStyle: { + color: props.axisLineColor, // 轴线的颜色 + }, + }, + axisLabel: { + color: props.fontColor, // X轴名称颜色 + fontSize: 14, + }, + splitLine: { + show: false, + lineStyle: { + color: ['#7a6b74'], + type: props.axisLineType, + }, + }, + }, + ], + yAxis: [ + { + name: props.unit, + type: 'value', + boundaryGap: true, + axisLine: { + show: false, + lineStyle: { + color: props.axisLineColor, // 轴线的颜色 + }, + }, + nameTextStyle: { + color: props.fontColor, + fontSize: 14, + verticalAlign: 'middle', + }, + splitLine: { + show: true, + lineStyle: { + color: ['#7a6b74'], + type: 'dashed', + }, + }, + }, + ], + series: [] as lineSeriesOption[], + } + // 标题 + if (props.title) { + option.title = { + show: true, + text: props.title, + } + } + // 图例 + if (props.legend && props.legendData.length > 0) { + option.legend!.data = props.legendData + } + // x轴数据 + if (props.xAxisData && props.xAxisData.length > 0) { + if (Array.isArray(option.xAxis) && option.xAxis.length > 0) { + option.xAxis[0].data = props.xAxisData // 横轴 + } + } + // 数据 + if (props.data) { + const newSeries: lineSeriesOption[] = [] + // 遍历data, 拆分轴线名称,数据和颜色 + for (const itemIndex in props.data) { + const item = props.data[itemIndex] + const series: lineSeriesOption = { + name: item.name, // 线系列名 + type: 'line', + symbol: 'none', // 去掉折线节点 + smooth: props.smooth, // 曲线平滑设置 + lineStyle: { + width: 2, + }, + data: item.data, + } + // 线段颜色 + if (item.color || props.colors.length > 0) { + series.itemStyle = { + color: item.color ? formatColor(item.color) : formatColor(props.colors[itemIndex] as string), + } + // 如果开启渐变 + if (props.gradient) { + series.areaStyle = { + color: new echarts.graphic.LinearGradient( + 0, 0, 0, 1, // 变化度 ,渐变方向 + [ + { + offset: 0.1, + color: item.color ? getAlphaColor(item.color, 0.6) : getAlphaColor(props.colors[itemIndex] as string, 0.6), + }, + { + offset: 1, + color: '#fff', + }, + ], + ), + } + } + } + newSeries.push(series) + } + option.series = newSeries + } + return option +} +// 初始化图表 +function initChart() { + chart = init(chartRef.value as HTMLElement, tdTheme) + chart.setOption({}) +} + +// 刷新图表 +function refreshChart() { + if (chart) { + const option = buildOption() + chart.setOption(option as unknown as ECBasicOption, true) + } +} + +window.addEventListener('resize', () => { + chart.resize() +}) + +onMounted(() => { + initChart() +}) + + + + + diff --git a/src/components/Echart/PieChart.vue b/src/components/Echart/PieChart.vue new file mode 100644 index 0000000..032ee81 --- /dev/null +++ b/src/components/Echart/PieChart.vue @@ -0,0 +1,270 @@ + + + + + diff --git a/src/components/Echart/echart-interface.ts b/src/components/Echart/echart-interface.ts new file mode 100644 index 0000000..e677f65 --- /dev/null +++ b/src/components/Echart/echart-interface.ts @@ -0,0 +1,220 @@ +import type { LinearGradientObject } from 'echarts' +// 折线数据格式 +export interface lineDataI { + name: string // 轴线名称 + data: string[] | number[] // 数值 + color?: string // 颜色 +} + +// 饼图数据格式 +export interface pieDataI { + name: string // 分类名称 + value: number // 分类值 +} +// 标题配置 +export interface titleOption { + title?: { + show?: boolean // 是否显示标题 + left?: number | string // 上边距 + right?: number | string // 右边距 + bottom?: number | string // 下边距 + top?: number | string // 顶部边距 + text: string // 标题 + } +} + +// 网格配置 +export interface gridOption { + grid?: { + show?: boolean // 是否显示直角坐标系网格 + left?: number | string // 上边距 + right?: number | string // 右边距 + bottom?: number | string // 下边距 + top?: number | string // 顶部边距 + containLabel?: boolean // grid区域是否包含坐标轴的刻度标签 + } +} +// 图例 +export interface legendOption { + legend?: { + show?: boolean + icon?: string // 图形样式 + orient?: string // 图例方向 + align?: string // 图例标记和文本的对齐,默认自动 + left?: number | string // 上边距 + right?: number | string // 右边距 + bottom?: number | string // 下边距 + top?: number | string // 顶部边距 + padding?: number | [number, number] | [number, number, number, number] // 内边距 + data?: string[] // 数值 + itemWidth?: number // 图例标记宽 + itemHeight?: number // 图例标记高 + itemStyle?: { // 图例标记样式 + decal?: string // 贴花图案 + } + } +} +// 提示框 +export interface tooltipOption { + tooltip: { + show?: boolean + trigger: 'axis' | 'item' | 'none' // 触发类型 + textStyle: { // 浮层的文本样式 + color?: string // 文字颜色,默认白色 + fontSize?: number // 文字大小, 默认14 + } + axisPointer?: { // 坐标轴指示器 + type: 'cross' | 'line' | 'shadow' | 'none' + label: { + show?: boolean // axisPointer为cross时默认显示,其他默认不显示 + fontSize?: number // 文字大小,默认14 + } + } + formatter?: string + valueFormatter?: (value: number | string) => string // 数值显示部分格式化回调函数 + } +} + +// x轴 +export interface xAxisOption { + type: string // 'category' | 'value' | 'time' | 'log' + name?: string + boundaryGap?: boolean | string[] + data?: Array // 类目数据,在类目轴(type=category)中有效 + axisLine?: { // 坐标轴线 + show?: boolean + lineStyle?: { + color?: string // 轴线的颜色 + width?: number // 轴线宽度,默认1 + } + } + nameTextStyle?: { // 坐标轴名称的文字样式。 + color?: string + fontSize?: number // 默认12 + verticalAlign: 'auto' | 'top' | 'middle' | 'bottom' // 文字垂直对齐方式 + } + axisLabel?: { // 坐标轴刻度标签 + color?: string // X轴名称颜色 + fontSize?: number // + } + splitLine: { // 坐标轴在 grid 区域中的分隔线 + show: boolean + interval?: string | number | ((index: number, value: string) => boolean) // 坐标轴分隔线的显示间隔 + lineStyle?: { + color?: string | Array + type?: string // 'dashed' | 'solid' | 'dotted' + shadowBlur?: number // 图形阴影的模糊大小 + shadowColor?: string // 阴影颜色 + shadowOffsetX?: number // 阴影水平方向的偏移距离 + shadowOffsetY?: number // 阴影垂直方向的偏移距离 + } + opacity?: number // 透明度,默认1 + } +} + +// Y轴 +export interface yAxisOption { + type: string // 'category' | 'value' | 'time' | 'log' + name?: string + boundaryGap?: boolean | string[] + data?: Array // 类目数据,在类目轴(type=category)中有效 + axisLine?: { // 坐标轴线 + show?: boolean + lineStyle?: { + color?: string // 轴线的颜色 + width?: number // 轴线宽度,默认1 + } + } + nameTextStyle?: { // 坐标轴名称的文字样式。 + color?: string + fontSize?: number // 默认12 + verticalAlign: 'auto' | 'top' | 'middle' | 'bottom' // 文字垂直对齐方式 + } + axisLabel?: { // 坐标轴刻度标签 + color?: string // X轴名称颜色 + fontSize?: number // + } + splitLine: { // 坐标轴在 grid 区域中的分隔线 + show?: boolean + interval?: string | number | ((index: number, value: string) => boolean) // 坐标轴分隔线的显示间隔 + lineStyle: { + color?: string | Array + type?: string // 'dashed' | 'solid' | 'dotted' + shadowBlur?: number // 图形阴影的模糊大小 + shadowColor?: string // 阴影颜色 + shadowOffsetX?: number // 阴影水平方向的偏移距离 + shadowOffsetY?: number // 阴影垂直方向的偏移距离 + } + opacity?: number // 透明度,默认1 + } +} + +// 折线series配置项 +export interface lineSeriesOption { + name?: string // 系列名称 + type: 'line' + symbol?: string | Function // 标记的图形 'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow', 'none' + smooth?: boolean // 曲线平滑设置, 默认false + itemStyle?: { // 折线拐点样式 + color?: string // 图形的颜色 + borderColor?: string // 图形的描边颜色 + borderWidth?: number // 描边线宽。默认0,无描边。 + shadowBlur?: number // 图形阴影的模糊大小 + shadowColor?: string // 阴影颜色 + shadowOffsetX?: number // 阴影水平方向的偏移距离 + shadowOffsetY?: number // 阴影垂直方向的偏移距离 + } + lineStyle?: { // 线条样式 + width: number // 线条宽度,默认2 + color?: string // 线条颜色, 默认#000 + type?: 'solid' | 'dashed' | 'dotted' // 默认solid + } + areaStyle?: { // 区域填充样式 + color?: string | LinearGradientObject // 填充颜色 + } + data: number[] | string[] +} +// 饼图series配置项 +export interface pieSeriesOption { + name?: string // 系列名称 + type: 'pie' + animationType?: string// 沿圆弧展开效果 expansion|scale + avoidLabelOverlap?: boolean // 是否启用防止标签重叠策略 + roseType?: string | boolean // 玫瑰图类型 + radius?: string[] // 饼图的半径[内半径,外半径] + center?: [string, string] // 圆心坐标[横坐标,纵坐标] + startAngle?: number // 开始的角度 //起始角度,支持范围[0, 360]。 + label?: { // 饼图图形上的文本标签 + show?: boolean // 是否显示 + position?: string // 标签位置 + fontSize?: number // 文字大小,默认12 + fontWeight?: string // 文字粗细 + lineHeight?: number // 行高 + formatter?: string | Function // 标签内容格式器 + rich?: object // 富文本样式 + emphasis?: { // 高亮状态的扇区和标签样式 + show?: boolean + textStyle: { + color?: string + fontSize?: number + fontWeight?: string + } + } + } + labelLine?: { // 视觉引导线 + show?: boolean + } + data: pieDataI[] +} +// 折线图配置项 +export interface lineOption extends titleOption, gridOption, legendOption, tooltipOption { + xAxis: xAxisOption | xAxisOption[] + yAxis: yAxisOption | yAxisOption[] + series: lineSeriesOption[] +} +// 饼图配置项 +export interface pieOption extends titleOption, gridOption, legendOption, tooltipOption { + color?: string[] + series: pieSeriesOption[] +} + diff --git a/src/components/Echart/index.vue b/src/components/Echart/index.vue deleted file mode 100644 index 9efe188..0000000 --- a/src/components/Echart/index.vue +++ /dev/null @@ -1,55 +0,0 @@ - - - - - diff --git a/src/components/Echart/theme.json b/src/components/Echart/theme.json index 58a1f46..365f766 100644 --- a/src/components/Echart/theme.json +++ b/src/components/Echart/theme.json @@ -255,7 +255,7 @@ "axisLabel": { "show": true, "textStyle": { - "color": "#fff" + "color": "#222" } }, "splitLine": { @@ -292,7 +292,7 @@ "axisLabel": { "show": true, "textStyle": { - "color": "#fff" + "color": "#333" } }, "splitLine": { @@ -399,7 +399,7 @@ }, "legend": { "textStyle": { - "color": "#fff" + "color": "#333" } }, "tooltip": { diff --git a/src/components/Echart/utils.ts b/src/components/Echart/utils.ts new file mode 100644 index 0000000..0acd088 --- /dev/null +++ b/src/components/Echart/utils.ts @@ -0,0 +1,38 @@ +/** + * 格式化颜色 + * @param value 颜色值 #aaa格式或rgb格式 + * @returns 颜色值 + */ +export function formatColor(value: string): string { + const rgbReg = /((2[0-4]\\d|25[0-5]|[01]?[0-9]?[0-9]?)[\\s]*,){2}[\\s]*(2[0-4]\\d|25[0-5]|[0-1]?[0-9]?[0-9])$/ + if (value.startsWith('#')) { // #号开头的颜色值 + return value + } + else if (rgbReg.test(value)) { // 数字开头的颜色值 + return `rgb(${value})` + } + else { + return '' + } +} + +/** + * 获取某颜色的透明度颜色 + * @param color 颜色 + * @param alpha 透明度 + * @returns 透明度颜色 + */ +export function getAlphaColor(color: string, alpha: number): string { + const rgbReg = /((2[0-4]\\d|25[0-5]|[01]?[0-9]?[0-9]?)[\\s]*,){2}[\\s]*(2[0-4]\\d|25[0-5]|[0-1]?[0-9]?[0-9])$/ + if (color.startsWith('#')) { // #号开头的颜色值 + let alpha2 = Math.floor(alpha * 255) + alpha2 = alpha > 255 ? 255 : alpha2 + return color + alpha2.toString(16) // 转换为16进制 + } + else if (rgbReg.test(color)) { // 数字开头的颜色值 + return `rgba(${color}, ${alpha})` + } + else { + return '' + } +} diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 4c53275..2b110cb 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -165,7 +165,7 @@
+// 逻辑代码 +const props = defineProps({ + title: { + type: String, + default: '', + }, + pathUrl: { + type: String, + default: '', + }, + width: { + type: String, + default: '', + }, + height: { + type: String, + default: '', + }, +}) + + + + + + diff --git a/src/api/device/standard.ts b/src/api/device/standard.ts index 6a6d694..4f0d99c 100644 --- a/src/api/device/standard.ts +++ b/src/api/device/standard.ts @@ -27,3 +27,31 @@ data, }) } + +// 详情信息 +export function getStandardListDetail(data: object) { + return request({ + url: `${prefix}/standard/detail`, + method: 'post', + data, + }) +} + +// 更新信息 +export function getStandardLisUpdate(data: object) { + return request({ + url: `${prefix}/standard/update`, + method: 'post', + data, + }) +} + +// 获取部门信息 +export function getUsersDept(data: object) { + return request({ + url: `/meter/organize/listPage?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} + diff --git a/src/components.d.ts b/src/components.d.ts index 0bb0edd..f202da8 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -14,11 +14,11 @@ Auth: typeof import('./components/Auth/index.vue')['default'] AuthAll: typeof import('./components/AuthAll/index.vue')['default'] BatchActionBar: typeof import('./components/BatchActionBar/index.vue')['default'] + BenchCol: typeof import('./components/benchCol/index.vue')['default'] ConditionDrawer: typeof import('./components/drawer/conditionDrawer.vue')['default'] CopyerDrawer: typeof import('./components/drawer/copyerDrawer.vue')['default'] Copyright: typeof import('./components/Copyright/index.vue')['default'] DeptSelect: typeof import('./components/DeptSelect/index.vue')['default'] - Echart: typeof import('./components/Echart/index.vue')['default'] Echarts: typeof import('./components/echarts/index.vue')['default'] Editor: typeof import('./components/Editor/index.vue')['default'] EmployeesDialog: typeof import('./components/dialog/employeesDialog.vue')['default'] @@ -29,6 +29,7 @@ ImagePreview: typeof import('./components/ImagePreview/index.vue')['default'] ImagesUpload: typeof import('./components/ImagesUpload/index.vue')['default'] ImageUpload: typeof import('./components/ImageUpload/index.vue')['default'] + LineChart: typeof import('./components/Echart/LineChart.vue')['default'] NodeWrap: typeof import('./components/workFlow/nodeWrap.vue')['default'] NodeWrapBan: typeof import('./components/workFlow/nodeWrapBan.vue')['default'] NormalTable: typeof import('./components/NormalTable/index.vue')['default'] @@ -36,6 +37,7 @@ PageMain: typeof import('./components/PageMain/index.vue')['default'] PcasCascader: typeof import('./components/PcasCascader/index.vue')['default'] Pie: typeof import('./components/echarts/pie.vue')['default'] + PieChart: typeof import('./components/Echart/PieChart.vue')['default'] PromoterDrawer: typeof import('./components/drawer/promoterDrawer.vue')['default'] RoleDialog: typeof import('./components/dialog/roleDialog.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] diff --git a/src/components/Echart/LineChart.vue b/src/components/Echart/LineChart.vue new file mode 100644 index 0000000..3fec782 --- /dev/null +++ b/src/components/Echart/LineChart.vue @@ -0,0 +1,350 @@ + + + + + diff --git a/src/components/Echart/PieChart.vue b/src/components/Echart/PieChart.vue new file mode 100644 index 0000000..032ee81 --- /dev/null +++ b/src/components/Echart/PieChart.vue @@ -0,0 +1,270 @@ + + + + + diff --git a/src/components/Echart/echart-interface.ts b/src/components/Echart/echart-interface.ts new file mode 100644 index 0000000..e677f65 --- /dev/null +++ b/src/components/Echart/echart-interface.ts @@ -0,0 +1,220 @@ +import type { LinearGradientObject } from 'echarts' +// 折线数据格式 +export interface lineDataI { + name: string // 轴线名称 + data: string[] | number[] // 数值 + color?: string // 颜色 +} + +// 饼图数据格式 +export interface pieDataI { + name: string // 分类名称 + value: number // 分类值 +} +// 标题配置 +export interface titleOption { + title?: { + show?: boolean // 是否显示标题 + left?: number | string // 上边距 + right?: number | string // 右边距 + bottom?: number | string // 下边距 + top?: number | string // 顶部边距 + text: string // 标题 + } +} + +// 网格配置 +export interface gridOption { + grid?: { + show?: boolean // 是否显示直角坐标系网格 + left?: number | string // 上边距 + right?: number | string // 右边距 + bottom?: number | string // 下边距 + top?: number | string // 顶部边距 + containLabel?: boolean // grid区域是否包含坐标轴的刻度标签 + } +} +// 图例 +export interface legendOption { + legend?: { + show?: boolean + icon?: string // 图形样式 + orient?: string // 图例方向 + align?: string // 图例标记和文本的对齐,默认自动 + left?: number | string // 上边距 + right?: number | string // 右边距 + bottom?: number | string // 下边距 + top?: number | string // 顶部边距 + padding?: number | [number, number] | [number, number, number, number] // 内边距 + data?: string[] // 数值 + itemWidth?: number // 图例标记宽 + itemHeight?: number // 图例标记高 + itemStyle?: { // 图例标记样式 + decal?: string // 贴花图案 + } + } +} +// 提示框 +export interface tooltipOption { + tooltip: { + show?: boolean + trigger: 'axis' | 'item' | 'none' // 触发类型 + textStyle: { // 浮层的文本样式 + color?: string // 文字颜色,默认白色 + fontSize?: number // 文字大小, 默认14 + } + axisPointer?: { // 坐标轴指示器 + type: 'cross' | 'line' | 'shadow' | 'none' + label: { + show?: boolean // axisPointer为cross时默认显示,其他默认不显示 + fontSize?: number // 文字大小,默认14 + } + } + formatter?: string + valueFormatter?: (value: number | string) => string // 数值显示部分格式化回调函数 + } +} + +// x轴 +export interface xAxisOption { + type: string // 'category' | 'value' | 'time' | 'log' + name?: string + boundaryGap?: boolean | string[] + data?: Array // 类目数据,在类目轴(type=category)中有效 + axisLine?: { // 坐标轴线 + show?: boolean + lineStyle?: { + color?: string // 轴线的颜色 + width?: number // 轴线宽度,默认1 + } + } + nameTextStyle?: { // 坐标轴名称的文字样式。 + color?: string + fontSize?: number // 默认12 + verticalAlign: 'auto' | 'top' | 'middle' | 'bottom' // 文字垂直对齐方式 + } + axisLabel?: { // 坐标轴刻度标签 + color?: string // X轴名称颜色 + fontSize?: number // + } + splitLine: { // 坐标轴在 grid 区域中的分隔线 + show: boolean + interval?: string | number | ((index: number, value: string) => boolean) // 坐标轴分隔线的显示间隔 + lineStyle?: { + color?: string | Array + type?: string // 'dashed' | 'solid' | 'dotted' + shadowBlur?: number // 图形阴影的模糊大小 + shadowColor?: string // 阴影颜色 + shadowOffsetX?: number // 阴影水平方向的偏移距离 + shadowOffsetY?: number // 阴影垂直方向的偏移距离 + } + opacity?: number // 透明度,默认1 + } +} + +// Y轴 +export interface yAxisOption { + type: string // 'category' | 'value' | 'time' | 'log' + name?: string + boundaryGap?: boolean | string[] + data?: Array // 类目数据,在类目轴(type=category)中有效 + axisLine?: { // 坐标轴线 + show?: boolean + lineStyle?: { + color?: string // 轴线的颜色 + width?: number // 轴线宽度,默认1 + } + } + nameTextStyle?: { // 坐标轴名称的文字样式。 + color?: string + fontSize?: number // 默认12 + verticalAlign: 'auto' | 'top' | 'middle' | 'bottom' // 文字垂直对齐方式 + } + axisLabel?: { // 坐标轴刻度标签 + color?: string // X轴名称颜色 + fontSize?: number // + } + splitLine: { // 坐标轴在 grid 区域中的分隔线 + show?: boolean + interval?: string | number | ((index: number, value: string) => boolean) // 坐标轴分隔线的显示间隔 + lineStyle: { + color?: string | Array + type?: string // 'dashed' | 'solid' | 'dotted' + shadowBlur?: number // 图形阴影的模糊大小 + shadowColor?: string // 阴影颜色 + shadowOffsetX?: number // 阴影水平方向的偏移距离 + shadowOffsetY?: number // 阴影垂直方向的偏移距离 + } + opacity?: number // 透明度,默认1 + } +} + +// 折线series配置项 +export interface lineSeriesOption { + name?: string // 系列名称 + type: 'line' + symbol?: string | Function // 标记的图形 'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow', 'none' + smooth?: boolean // 曲线平滑设置, 默认false + itemStyle?: { // 折线拐点样式 + color?: string // 图形的颜色 + borderColor?: string // 图形的描边颜色 + borderWidth?: number // 描边线宽。默认0,无描边。 + shadowBlur?: number // 图形阴影的模糊大小 + shadowColor?: string // 阴影颜色 + shadowOffsetX?: number // 阴影水平方向的偏移距离 + shadowOffsetY?: number // 阴影垂直方向的偏移距离 + } + lineStyle?: { // 线条样式 + width: number // 线条宽度,默认2 + color?: string // 线条颜色, 默认#000 + type?: 'solid' | 'dashed' | 'dotted' // 默认solid + } + areaStyle?: { // 区域填充样式 + color?: string | LinearGradientObject // 填充颜色 + } + data: number[] | string[] +} +// 饼图series配置项 +export interface pieSeriesOption { + name?: string // 系列名称 + type: 'pie' + animationType?: string// 沿圆弧展开效果 expansion|scale + avoidLabelOverlap?: boolean // 是否启用防止标签重叠策略 + roseType?: string | boolean // 玫瑰图类型 + radius?: string[] // 饼图的半径[内半径,外半径] + center?: [string, string] // 圆心坐标[横坐标,纵坐标] + startAngle?: number // 开始的角度 //起始角度,支持范围[0, 360]。 + label?: { // 饼图图形上的文本标签 + show?: boolean // 是否显示 + position?: string // 标签位置 + fontSize?: number // 文字大小,默认12 + fontWeight?: string // 文字粗细 + lineHeight?: number // 行高 + formatter?: string | Function // 标签内容格式器 + rich?: object // 富文本样式 + emphasis?: { // 高亮状态的扇区和标签样式 + show?: boolean + textStyle: { + color?: string + fontSize?: number + fontWeight?: string + } + } + } + labelLine?: { // 视觉引导线 + show?: boolean + } + data: pieDataI[] +} +// 折线图配置项 +export interface lineOption extends titleOption, gridOption, legendOption, tooltipOption { + xAxis: xAxisOption | xAxisOption[] + yAxis: yAxisOption | yAxisOption[] + series: lineSeriesOption[] +} +// 饼图配置项 +export interface pieOption extends titleOption, gridOption, legendOption, tooltipOption { + color?: string[] + series: pieSeriesOption[] +} + diff --git a/src/components/Echart/index.vue b/src/components/Echart/index.vue deleted file mode 100644 index 9efe188..0000000 --- a/src/components/Echart/index.vue +++ /dev/null @@ -1,55 +0,0 @@ - - - - - diff --git a/src/components/Echart/theme.json b/src/components/Echart/theme.json index 58a1f46..365f766 100644 --- a/src/components/Echart/theme.json +++ b/src/components/Echart/theme.json @@ -255,7 +255,7 @@ "axisLabel": { "show": true, "textStyle": { - "color": "#fff" + "color": "#222" } }, "splitLine": { @@ -292,7 +292,7 @@ "axisLabel": { "show": true, "textStyle": { - "color": "#fff" + "color": "#333" } }, "splitLine": { @@ -399,7 +399,7 @@ }, "legend": { "textStyle": { - "color": "#fff" + "color": "#333" } }, "tooltip": { diff --git a/src/components/Echart/utils.ts b/src/components/Echart/utils.ts new file mode 100644 index 0000000..0acd088 --- /dev/null +++ b/src/components/Echart/utils.ts @@ -0,0 +1,38 @@ +/** + * 格式化颜色 + * @param value 颜色值 #aaa格式或rgb格式 + * @returns 颜色值 + */ +export function formatColor(value: string): string { + const rgbReg = /((2[0-4]\\d|25[0-5]|[01]?[0-9]?[0-9]?)[\\s]*,){2}[\\s]*(2[0-4]\\d|25[0-5]|[0-1]?[0-9]?[0-9])$/ + if (value.startsWith('#')) { // #号开头的颜色值 + return value + } + else if (rgbReg.test(value)) { // 数字开头的颜色值 + return `rgb(${value})` + } + else { + return '' + } +} + +/** + * 获取某颜色的透明度颜色 + * @param color 颜色 + * @param alpha 透明度 + * @returns 透明度颜色 + */ +export function getAlphaColor(color: string, alpha: number): string { + const rgbReg = /((2[0-4]\\d|25[0-5]|[01]?[0-9]?[0-9]?)[\\s]*,){2}[\\s]*(2[0-4]\\d|25[0-5]|[0-1]?[0-9]?[0-9])$/ + if (color.startsWith('#')) { // #号开头的颜色值 + let alpha2 = Math.floor(alpha * 255) + alpha2 = alpha > 255 ? 255 : alpha2 + return color + alpha2.toString(16) // 转换为16进制 + } + else if (rgbReg.test(color)) { // 数字开头的颜色值 + return `rgba(${color}, ${alpha})` + } + else { + return '' + } +} diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 4c53275..2b110cb 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -165,7 +165,7 @@
+// 逻辑代码 +const props = defineProps({ + title: { + type: String, + default: '', + }, + pathUrl: { + type: String, + default: '', + }, + width: { + type: String, + default: '', + }, + height: { + type: String, + default: '', + }, +}) + + + + + + diff --git a/src/components/echarts/index.vue b/src/components/echarts/index.vue index 1f6f6aa..c385dae 100644 --- a/src/components/echarts/index.vue +++ b/src/components/echarts/index.vue @@ -107,7 +107,7 @@ symbolSize: 2, // 拐点大小 // 折线条的样式 lineStyle: { - color: '#58abf0', + color: '#3d7eff', }, // 折线拐点的样式 itemStyle: { @@ -158,6 +158,6 @@ diff --git a/src/api/device/standard.ts b/src/api/device/standard.ts index 6a6d694..4f0d99c 100644 --- a/src/api/device/standard.ts +++ b/src/api/device/standard.ts @@ -27,3 +27,31 @@ data, }) } + +// 详情信息 +export function getStandardListDetail(data: object) { + return request({ + url: `${prefix}/standard/detail`, + method: 'post', + data, + }) +} + +// 更新信息 +export function getStandardLisUpdate(data: object) { + return request({ + url: `${prefix}/standard/update`, + method: 'post', + data, + }) +} + +// 获取部门信息 +export function getUsersDept(data: object) { + return request({ + url: `/meter/organize/listPage?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} + diff --git a/src/components.d.ts b/src/components.d.ts index 0bb0edd..f202da8 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -14,11 +14,11 @@ Auth: typeof import('./components/Auth/index.vue')['default'] AuthAll: typeof import('./components/AuthAll/index.vue')['default'] BatchActionBar: typeof import('./components/BatchActionBar/index.vue')['default'] + BenchCol: typeof import('./components/benchCol/index.vue')['default'] ConditionDrawer: typeof import('./components/drawer/conditionDrawer.vue')['default'] CopyerDrawer: typeof import('./components/drawer/copyerDrawer.vue')['default'] Copyright: typeof import('./components/Copyright/index.vue')['default'] DeptSelect: typeof import('./components/DeptSelect/index.vue')['default'] - Echart: typeof import('./components/Echart/index.vue')['default'] Echarts: typeof import('./components/echarts/index.vue')['default'] Editor: typeof import('./components/Editor/index.vue')['default'] EmployeesDialog: typeof import('./components/dialog/employeesDialog.vue')['default'] @@ -29,6 +29,7 @@ ImagePreview: typeof import('./components/ImagePreview/index.vue')['default'] ImagesUpload: typeof import('./components/ImagesUpload/index.vue')['default'] ImageUpload: typeof import('./components/ImageUpload/index.vue')['default'] + LineChart: typeof import('./components/Echart/LineChart.vue')['default'] NodeWrap: typeof import('./components/workFlow/nodeWrap.vue')['default'] NodeWrapBan: typeof import('./components/workFlow/nodeWrapBan.vue')['default'] NormalTable: typeof import('./components/NormalTable/index.vue')['default'] @@ -36,6 +37,7 @@ PageMain: typeof import('./components/PageMain/index.vue')['default'] PcasCascader: typeof import('./components/PcasCascader/index.vue')['default'] Pie: typeof import('./components/echarts/pie.vue')['default'] + PieChart: typeof import('./components/Echart/PieChart.vue')['default'] PromoterDrawer: typeof import('./components/drawer/promoterDrawer.vue')['default'] RoleDialog: typeof import('./components/dialog/roleDialog.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] diff --git a/src/components/Echart/LineChart.vue b/src/components/Echart/LineChart.vue new file mode 100644 index 0000000..3fec782 --- /dev/null +++ b/src/components/Echart/LineChart.vue @@ -0,0 +1,350 @@ + + + + + diff --git a/src/components/Echart/PieChart.vue b/src/components/Echart/PieChart.vue new file mode 100644 index 0000000..032ee81 --- /dev/null +++ b/src/components/Echart/PieChart.vue @@ -0,0 +1,270 @@ + + + + + diff --git a/src/components/Echart/echart-interface.ts b/src/components/Echart/echart-interface.ts new file mode 100644 index 0000000..e677f65 --- /dev/null +++ b/src/components/Echart/echart-interface.ts @@ -0,0 +1,220 @@ +import type { LinearGradientObject } from 'echarts' +// 折线数据格式 +export interface lineDataI { + name: string // 轴线名称 + data: string[] | number[] // 数值 + color?: string // 颜色 +} + +// 饼图数据格式 +export interface pieDataI { + name: string // 分类名称 + value: number // 分类值 +} +// 标题配置 +export interface titleOption { + title?: { + show?: boolean // 是否显示标题 + left?: number | string // 上边距 + right?: number | string // 右边距 + bottom?: number | string // 下边距 + top?: number | string // 顶部边距 + text: string // 标题 + } +} + +// 网格配置 +export interface gridOption { + grid?: { + show?: boolean // 是否显示直角坐标系网格 + left?: number | string // 上边距 + right?: number | string // 右边距 + bottom?: number | string // 下边距 + top?: number | string // 顶部边距 + containLabel?: boolean // grid区域是否包含坐标轴的刻度标签 + } +} +// 图例 +export interface legendOption { + legend?: { + show?: boolean + icon?: string // 图形样式 + orient?: string // 图例方向 + align?: string // 图例标记和文本的对齐,默认自动 + left?: number | string // 上边距 + right?: number | string // 右边距 + bottom?: number | string // 下边距 + top?: number | string // 顶部边距 + padding?: number | [number, number] | [number, number, number, number] // 内边距 + data?: string[] // 数值 + itemWidth?: number // 图例标记宽 + itemHeight?: number // 图例标记高 + itemStyle?: { // 图例标记样式 + decal?: string // 贴花图案 + } + } +} +// 提示框 +export interface tooltipOption { + tooltip: { + show?: boolean + trigger: 'axis' | 'item' | 'none' // 触发类型 + textStyle: { // 浮层的文本样式 + color?: string // 文字颜色,默认白色 + fontSize?: number // 文字大小, 默认14 + } + axisPointer?: { // 坐标轴指示器 + type: 'cross' | 'line' | 'shadow' | 'none' + label: { + show?: boolean // axisPointer为cross时默认显示,其他默认不显示 + fontSize?: number // 文字大小,默认14 + } + } + formatter?: string + valueFormatter?: (value: number | string) => string // 数值显示部分格式化回调函数 + } +} + +// x轴 +export interface xAxisOption { + type: string // 'category' | 'value' | 'time' | 'log' + name?: string + boundaryGap?: boolean | string[] + data?: Array // 类目数据,在类目轴(type=category)中有效 + axisLine?: { // 坐标轴线 + show?: boolean + lineStyle?: { + color?: string // 轴线的颜色 + width?: number // 轴线宽度,默认1 + } + } + nameTextStyle?: { // 坐标轴名称的文字样式。 + color?: string + fontSize?: number // 默认12 + verticalAlign: 'auto' | 'top' | 'middle' | 'bottom' // 文字垂直对齐方式 + } + axisLabel?: { // 坐标轴刻度标签 + color?: string // X轴名称颜色 + fontSize?: number // + } + splitLine: { // 坐标轴在 grid 区域中的分隔线 + show: boolean + interval?: string | number | ((index: number, value: string) => boolean) // 坐标轴分隔线的显示间隔 + lineStyle?: { + color?: string | Array + type?: string // 'dashed' | 'solid' | 'dotted' + shadowBlur?: number // 图形阴影的模糊大小 + shadowColor?: string // 阴影颜色 + shadowOffsetX?: number // 阴影水平方向的偏移距离 + shadowOffsetY?: number // 阴影垂直方向的偏移距离 + } + opacity?: number // 透明度,默认1 + } +} + +// Y轴 +export interface yAxisOption { + type: string // 'category' | 'value' | 'time' | 'log' + name?: string + boundaryGap?: boolean | string[] + data?: Array // 类目数据,在类目轴(type=category)中有效 + axisLine?: { // 坐标轴线 + show?: boolean + lineStyle?: { + color?: string // 轴线的颜色 + width?: number // 轴线宽度,默认1 + } + } + nameTextStyle?: { // 坐标轴名称的文字样式。 + color?: string + fontSize?: number // 默认12 + verticalAlign: 'auto' | 'top' | 'middle' | 'bottom' // 文字垂直对齐方式 + } + axisLabel?: { // 坐标轴刻度标签 + color?: string // X轴名称颜色 + fontSize?: number // + } + splitLine: { // 坐标轴在 grid 区域中的分隔线 + show?: boolean + interval?: string | number | ((index: number, value: string) => boolean) // 坐标轴分隔线的显示间隔 + lineStyle: { + color?: string | Array + type?: string // 'dashed' | 'solid' | 'dotted' + shadowBlur?: number // 图形阴影的模糊大小 + shadowColor?: string // 阴影颜色 + shadowOffsetX?: number // 阴影水平方向的偏移距离 + shadowOffsetY?: number // 阴影垂直方向的偏移距离 + } + opacity?: number // 透明度,默认1 + } +} + +// 折线series配置项 +export interface lineSeriesOption { + name?: string // 系列名称 + type: 'line' + symbol?: string | Function // 标记的图形 'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow', 'none' + smooth?: boolean // 曲线平滑设置, 默认false + itemStyle?: { // 折线拐点样式 + color?: string // 图形的颜色 + borderColor?: string // 图形的描边颜色 + borderWidth?: number // 描边线宽。默认0,无描边。 + shadowBlur?: number // 图形阴影的模糊大小 + shadowColor?: string // 阴影颜色 + shadowOffsetX?: number // 阴影水平方向的偏移距离 + shadowOffsetY?: number // 阴影垂直方向的偏移距离 + } + lineStyle?: { // 线条样式 + width: number // 线条宽度,默认2 + color?: string // 线条颜色, 默认#000 + type?: 'solid' | 'dashed' | 'dotted' // 默认solid + } + areaStyle?: { // 区域填充样式 + color?: string | LinearGradientObject // 填充颜色 + } + data: number[] | string[] +} +// 饼图series配置项 +export interface pieSeriesOption { + name?: string // 系列名称 + type: 'pie' + animationType?: string// 沿圆弧展开效果 expansion|scale + avoidLabelOverlap?: boolean // 是否启用防止标签重叠策略 + roseType?: string | boolean // 玫瑰图类型 + radius?: string[] // 饼图的半径[内半径,外半径] + center?: [string, string] // 圆心坐标[横坐标,纵坐标] + startAngle?: number // 开始的角度 //起始角度,支持范围[0, 360]。 + label?: { // 饼图图形上的文本标签 + show?: boolean // 是否显示 + position?: string // 标签位置 + fontSize?: number // 文字大小,默认12 + fontWeight?: string // 文字粗细 + lineHeight?: number // 行高 + formatter?: string | Function // 标签内容格式器 + rich?: object // 富文本样式 + emphasis?: { // 高亮状态的扇区和标签样式 + show?: boolean + textStyle: { + color?: string + fontSize?: number + fontWeight?: string + } + } + } + labelLine?: { // 视觉引导线 + show?: boolean + } + data: pieDataI[] +} +// 折线图配置项 +export interface lineOption extends titleOption, gridOption, legendOption, tooltipOption { + xAxis: xAxisOption | xAxisOption[] + yAxis: yAxisOption | yAxisOption[] + series: lineSeriesOption[] +} +// 饼图配置项 +export interface pieOption extends titleOption, gridOption, legendOption, tooltipOption { + color?: string[] + series: pieSeriesOption[] +} + diff --git a/src/components/Echart/index.vue b/src/components/Echart/index.vue deleted file mode 100644 index 9efe188..0000000 --- a/src/components/Echart/index.vue +++ /dev/null @@ -1,55 +0,0 @@ - - - - - diff --git a/src/components/Echart/theme.json b/src/components/Echart/theme.json index 58a1f46..365f766 100644 --- a/src/components/Echart/theme.json +++ b/src/components/Echart/theme.json @@ -255,7 +255,7 @@ "axisLabel": { "show": true, "textStyle": { - "color": "#fff" + "color": "#222" } }, "splitLine": { @@ -292,7 +292,7 @@ "axisLabel": { "show": true, "textStyle": { - "color": "#fff" + "color": "#333" } }, "splitLine": { @@ -399,7 +399,7 @@ }, "legend": { "textStyle": { - "color": "#fff" + "color": "#333" } }, "tooltip": { diff --git a/src/components/Echart/utils.ts b/src/components/Echart/utils.ts new file mode 100644 index 0000000..0acd088 --- /dev/null +++ b/src/components/Echart/utils.ts @@ -0,0 +1,38 @@ +/** + * 格式化颜色 + * @param value 颜色值 #aaa格式或rgb格式 + * @returns 颜色值 + */ +export function formatColor(value: string): string { + const rgbReg = /((2[0-4]\\d|25[0-5]|[01]?[0-9]?[0-9]?)[\\s]*,){2}[\\s]*(2[0-4]\\d|25[0-5]|[0-1]?[0-9]?[0-9])$/ + if (value.startsWith('#')) { // #号开头的颜色值 + return value + } + else if (rgbReg.test(value)) { // 数字开头的颜色值 + return `rgb(${value})` + } + else { + return '' + } +} + +/** + * 获取某颜色的透明度颜色 + * @param color 颜色 + * @param alpha 透明度 + * @returns 透明度颜色 + */ +export function getAlphaColor(color: string, alpha: number): string { + const rgbReg = /((2[0-4]\\d|25[0-5]|[01]?[0-9]?[0-9]?)[\\s]*,){2}[\\s]*(2[0-4]\\d|25[0-5]|[0-1]?[0-9]?[0-9])$/ + if (color.startsWith('#')) { // #号开头的颜色值 + let alpha2 = Math.floor(alpha * 255) + alpha2 = alpha > 255 ? 255 : alpha2 + return color + alpha2.toString(16) // 转换为16进制 + } + else if (rgbReg.test(color)) { // 数字开头的颜色值 + return `rgba(${color}, ${alpha})` + } + else { + return '' + } +} diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 4c53275..2b110cb 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -165,7 +165,7 @@
+// 逻辑代码 +const props = defineProps({ + title: { + type: String, + default: '', + }, + pathUrl: { + type: String, + default: '', + }, + width: { + type: String, + default: '', + }, + height: { + type: String, + default: '', + }, +}) + + + + + + diff --git a/src/components/echarts/index.vue b/src/components/echarts/index.vue index 1f6f6aa..c385dae 100644 --- a/src/components/echarts/index.vue +++ b/src/components/echarts/index.vue @@ -107,7 +107,7 @@ symbolSize: 2, // 拐点大小 // 折线条的样式 lineStyle: { - color: '#58abf0', + color: '#3d7eff', }, // 折线拐点的样式 itemStyle: { @@ -158,6 +158,6 @@ diff --git a/src/components/echarts/pie.vue b/src/components/echarts/pie.vue index 3ad8db6..1bbfb93 100644 --- a/src/components/echarts/pie.vue +++ b/src/components/echarts/pie.vue @@ -25,12 +25,12 @@ tooltip: { trigger: 'item', }, - color: ['rgb(40, 184, 228)', '#ccc'], + color: ['#3d7eff', '#ccc'], legend: { orient: 'vertical', right: '0', - bottom: '50%', - itemGap: 20, + bottom: '40%', + itemGap: 10, }, graphic: { type: 'text', @@ -95,6 +95,6 @@ .bars_w { width: 100%; height: 90%; - transform: translateX(-25%); + transform: translate(-10%, -30%); } diff --git a/src/api/device/standard.ts b/src/api/device/standard.ts index 6a6d694..4f0d99c 100644 --- a/src/api/device/standard.ts +++ b/src/api/device/standard.ts @@ -27,3 +27,31 @@ data, }) } + +// 详情信息 +export function getStandardListDetail(data: object) { + return request({ + url: `${prefix}/standard/detail`, + method: 'post', + data, + }) +} + +// 更新信息 +export function getStandardLisUpdate(data: object) { + return request({ + url: `${prefix}/standard/update`, + method: 'post', + data, + }) +} + +// 获取部门信息 +export function getUsersDept(data: object) { + return request({ + url: `/meter/organize/listPage?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} + diff --git a/src/components.d.ts b/src/components.d.ts index 0bb0edd..f202da8 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -14,11 +14,11 @@ Auth: typeof import('./components/Auth/index.vue')['default'] AuthAll: typeof import('./components/AuthAll/index.vue')['default'] BatchActionBar: typeof import('./components/BatchActionBar/index.vue')['default'] + BenchCol: typeof import('./components/benchCol/index.vue')['default'] ConditionDrawer: typeof import('./components/drawer/conditionDrawer.vue')['default'] CopyerDrawer: typeof import('./components/drawer/copyerDrawer.vue')['default'] Copyright: typeof import('./components/Copyright/index.vue')['default'] DeptSelect: typeof import('./components/DeptSelect/index.vue')['default'] - Echart: typeof import('./components/Echart/index.vue')['default'] Echarts: typeof import('./components/echarts/index.vue')['default'] Editor: typeof import('./components/Editor/index.vue')['default'] EmployeesDialog: typeof import('./components/dialog/employeesDialog.vue')['default'] @@ -29,6 +29,7 @@ ImagePreview: typeof import('./components/ImagePreview/index.vue')['default'] ImagesUpload: typeof import('./components/ImagesUpload/index.vue')['default'] ImageUpload: typeof import('./components/ImageUpload/index.vue')['default'] + LineChart: typeof import('./components/Echart/LineChart.vue')['default'] NodeWrap: typeof import('./components/workFlow/nodeWrap.vue')['default'] NodeWrapBan: typeof import('./components/workFlow/nodeWrapBan.vue')['default'] NormalTable: typeof import('./components/NormalTable/index.vue')['default'] @@ -36,6 +37,7 @@ PageMain: typeof import('./components/PageMain/index.vue')['default'] PcasCascader: typeof import('./components/PcasCascader/index.vue')['default'] Pie: typeof import('./components/echarts/pie.vue')['default'] + PieChart: typeof import('./components/Echart/PieChart.vue')['default'] PromoterDrawer: typeof import('./components/drawer/promoterDrawer.vue')['default'] RoleDialog: typeof import('./components/dialog/roleDialog.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] diff --git a/src/components/Echart/LineChart.vue b/src/components/Echart/LineChart.vue new file mode 100644 index 0000000..3fec782 --- /dev/null +++ b/src/components/Echart/LineChart.vue @@ -0,0 +1,350 @@ + + + + + diff --git a/src/components/Echart/PieChart.vue b/src/components/Echart/PieChart.vue new file mode 100644 index 0000000..032ee81 --- /dev/null +++ b/src/components/Echart/PieChart.vue @@ -0,0 +1,270 @@ + + + + + diff --git a/src/components/Echart/echart-interface.ts b/src/components/Echart/echart-interface.ts new file mode 100644 index 0000000..e677f65 --- /dev/null +++ b/src/components/Echart/echart-interface.ts @@ -0,0 +1,220 @@ +import type { LinearGradientObject } from 'echarts' +// 折线数据格式 +export interface lineDataI { + name: string // 轴线名称 + data: string[] | number[] // 数值 + color?: string // 颜色 +} + +// 饼图数据格式 +export interface pieDataI { + name: string // 分类名称 + value: number // 分类值 +} +// 标题配置 +export interface titleOption { + title?: { + show?: boolean // 是否显示标题 + left?: number | string // 上边距 + right?: number | string // 右边距 + bottom?: number | string // 下边距 + top?: number | string // 顶部边距 + text: string // 标题 + } +} + +// 网格配置 +export interface gridOption { + grid?: { + show?: boolean // 是否显示直角坐标系网格 + left?: number | string // 上边距 + right?: number | string // 右边距 + bottom?: number | string // 下边距 + top?: number | string // 顶部边距 + containLabel?: boolean // grid区域是否包含坐标轴的刻度标签 + } +} +// 图例 +export interface legendOption { + legend?: { + show?: boolean + icon?: string // 图形样式 + orient?: string // 图例方向 + align?: string // 图例标记和文本的对齐,默认自动 + left?: number | string // 上边距 + right?: number | string // 右边距 + bottom?: number | string // 下边距 + top?: number | string // 顶部边距 + padding?: number | [number, number] | [number, number, number, number] // 内边距 + data?: string[] // 数值 + itemWidth?: number // 图例标记宽 + itemHeight?: number // 图例标记高 + itemStyle?: { // 图例标记样式 + decal?: string // 贴花图案 + } + } +} +// 提示框 +export interface tooltipOption { + tooltip: { + show?: boolean + trigger: 'axis' | 'item' | 'none' // 触发类型 + textStyle: { // 浮层的文本样式 + color?: string // 文字颜色,默认白色 + fontSize?: number // 文字大小, 默认14 + } + axisPointer?: { // 坐标轴指示器 + type: 'cross' | 'line' | 'shadow' | 'none' + label: { + show?: boolean // axisPointer为cross时默认显示,其他默认不显示 + fontSize?: number // 文字大小,默认14 + } + } + formatter?: string + valueFormatter?: (value: number | string) => string // 数值显示部分格式化回调函数 + } +} + +// x轴 +export interface xAxisOption { + type: string // 'category' | 'value' | 'time' | 'log' + name?: string + boundaryGap?: boolean | string[] + data?: Array // 类目数据,在类目轴(type=category)中有效 + axisLine?: { // 坐标轴线 + show?: boolean + lineStyle?: { + color?: string // 轴线的颜色 + width?: number // 轴线宽度,默认1 + } + } + nameTextStyle?: { // 坐标轴名称的文字样式。 + color?: string + fontSize?: number // 默认12 + verticalAlign: 'auto' | 'top' | 'middle' | 'bottom' // 文字垂直对齐方式 + } + axisLabel?: { // 坐标轴刻度标签 + color?: string // X轴名称颜色 + fontSize?: number // + } + splitLine: { // 坐标轴在 grid 区域中的分隔线 + show: boolean + interval?: string | number | ((index: number, value: string) => boolean) // 坐标轴分隔线的显示间隔 + lineStyle?: { + color?: string | Array + type?: string // 'dashed' | 'solid' | 'dotted' + shadowBlur?: number // 图形阴影的模糊大小 + shadowColor?: string // 阴影颜色 + shadowOffsetX?: number // 阴影水平方向的偏移距离 + shadowOffsetY?: number // 阴影垂直方向的偏移距离 + } + opacity?: number // 透明度,默认1 + } +} + +// Y轴 +export interface yAxisOption { + type: string // 'category' | 'value' | 'time' | 'log' + name?: string + boundaryGap?: boolean | string[] + data?: Array // 类目数据,在类目轴(type=category)中有效 + axisLine?: { // 坐标轴线 + show?: boolean + lineStyle?: { + color?: string // 轴线的颜色 + width?: number // 轴线宽度,默认1 + } + } + nameTextStyle?: { // 坐标轴名称的文字样式。 + color?: string + fontSize?: number // 默认12 + verticalAlign: 'auto' | 'top' | 'middle' | 'bottom' // 文字垂直对齐方式 + } + axisLabel?: { // 坐标轴刻度标签 + color?: string // X轴名称颜色 + fontSize?: number // + } + splitLine: { // 坐标轴在 grid 区域中的分隔线 + show?: boolean + interval?: string | number | ((index: number, value: string) => boolean) // 坐标轴分隔线的显示间隔 + lineStyle: { + color?: string | Array + type?: string // 'dashed' | 'solid' | 'dotted' + shadowBlur?: number // 图形阴影的模糊大小 + shadowColor?: string // 阴影颜色 + shadowOffsetX?: number // 阴影水平方向的偏移距离 + shadowOffsetY?: number // 阴影垂直方向的偏移距离 + } + opacity?: number // 透明度,默认1 + } +} + +// 折线series配置项 +export interface lineSeriesOption { + name?: string // 系列名称 + type: 'line' + symbol?: string | Function // 标记的图形 'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow', 'none' + smooth?: boolean // 曲线平滑设置, 默认false + itemStyle?: { // 折线拐点样式 + color?: string // 图形的颜色 + borderColor?: string // 图形的描边颜色 + borderWidth?: number // 描边线宽。默认0,无描边。 + shadowBlur?: number // 图形阴影的模糊大小 + shadowColor?: string // 阴影颜色 + shadowOffsetX?: number // 阴影水平方向的偏移距离 + shadowOffsetY?: number // 阴影垂直方向的偏移距离 + } + lineStyle?: { // 线条样式 + width: number // 线条宽度,默认2 + color?: string // 线条颜色, 默认#000 + type?: 'solid' | 'dashed' | 'dotted' // 默认solid + } + areaStyle?: { // 区域填充样式 + color?: string | LinearGradientObject // 填充颜色 + } + data: number[] | string[] +} +// 饼图series配置项 +export interface pieSeriesOption { + name?: string // 系列名称 + type: 'pie' + animationType?: string// 沿圆弧展开效果 expansion|scale + avoidLabelOverlap?: boolean // 是否启用防止标签重叠策略 + roseType?: string | boolean // 玫瑰图类型 + radius?: string[] // 饼图的半径[内半径,外半径] + center?: [string, string] // 圆心坐标[横坐标,纵坐标] + startAngle?: number // 开始的角度 //起始角度,支持范围[0, 360]。 + label?: { // 饼图图形上的文本标签 + show?: boolean // 是否显示 + position?: string // 标签位置 + fontSize?: number // 文字大小,默认12 + fontWeight?: string // 文字粗细 + lineHeight?: number // 行高 + formatter?: string | Function // 标签内容格式器 + rich?: object // 富文本样式 + emphasis?: { // 高亮状态的扇区和标签样式 + show?: boolean + textStyle: { + color?: string + fontSize?: number + fontWeight?: string + } + } + } + labelLine?: { // 视觉引导线 + show?: boolean + } + data: pieDataI[] +} +// 折线图配置项 +export interface lineOption extends titleOption, gridOption, legendOption, tooltipOption { + xAxis: xAxisOption | xAxisOption[] + yAxis: yAxisOption | yAxisOption[] + series: lineSeriesOption[] +} +// 饼图配置项 +export interface pieOption extends titleOption, gridOption, legendOption, tooltipOption { + color?: string[] + series: pieSeriesOption[] +} + diff --git a/src/components/Echart/index.vue b/src/components/Echart/index.vue deleted file mode 100644 index 9efe188..0000000 --- a/src/components/Echart/index.vue +++ /dev/null @@ -1,55 +0,0 @@ - - - - - diff --git a/src/components/Echart/theme.json b/src/components/Echart/theme.json index 58a1f46..365f766 100644 --- a/src/components/Echart/theme.json +++ b/src/components/Echart/theme.json @@ -255,7 +255,7 @@ "axisLabel": { "show": true, "textStyle": { - "color": "#fff" + "color": "#222" } }, "splitLine": { @@ -292,7 +292,7 @@ "axisLabel": { "show": true, "textStyle": { - "color": "#fff" + "color": "#333" } }, "splitLine": { @@ -399,7 +399,7 @@ }, "legend": { "textStyle": { - "color": "#fff" + "color": "#333" } }, "tooltip": { diff --git a/src/components/Echart/utils.ts b/src/components/Echart/utils.ts new file mode 100644 index 0000000..0acd088 --- /dev/null +++ b/src/components/Echart/utils.ts @@ -0,0 +1,38 @@ +/** + * 格式化颜色 + * @param value 颜色值 #aaa格式或rgb格式 + * @returns 颜色值 + */ +export function formatColor(value: string): string { + const rgbReg = /((2[0-4]\\d|25[0-5]|[01]?[0-9]?[0-9]?)[\\s]*,){2}[\\s]*(2[0-4]\\d|25[0-5]|[0-1]?[0-9]?[0-9])$/ + if (value.startsWith('#')) { // #号开头的颜色值 + return value + } + else if (rgbReg.test(value)) { // 数字开头的颜色值 + return `rgb(${value})` + } + else { + return '' + } +} + +/** + * 获取某颜色的透明度颜色 + * @param color 颜色 + * @param alpha 透明度 + * @returns 透明度颜色 + */ +export function getAlphaColor(color: string, alpha: number): string { + const rgbReg = /((2[0-4]\\d|25[0-5]|[01]?[0-9]?[0-9]?)[\\s]*,){2}[\\s]*(2[0-4]\\d|25[0-5]|[0-1]?[0-9]?[0-9])$/ + if (color.startsWith('#')) { // #号开头的颜色值 + let alpha2 = Math.floor(alpha * 255) + alpha2 = alpha > 255 ? 255 : alpha2 + return color + alpha2.toString(16) // 转换为16进制 + } + else if (rgbReg.test(color)) { // 数字开头的颜色值 + return `rgba(${color}, ${alpha})` + } + else { + return '' + } +} diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 4c53275..2b110cb 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -165,7 +165,7 @@
+// 逻辑代码 +const props = defineProps({ + title: { + type: String, + default: '', + }, + pathUrl: { + type: String, + default: '', + }, + width: { + type: String, + default: '', + }, + height: { + type: String, + default: '', + }, +}) + + + + + + diff --git a/src/components/echarts/index.vue b/src/components/echarts/index.vue index 1f6f6aa..c385dae 100644 --- a/src/components/echarts/index.vue +++ b/src/components/echarts/index.vue @@ -107,7 +107,7 @@ symbolSize: 2, // 拐点大小 // 折线条的样式 lineStyle: { - color: '#58abf0', + color: '#3d7eff', }, // 折线拐点的样式 itemStyle: { @@ -158,6 +158,6 @@ diff --git a/src/components/echarts/pie.vue b/src/components/echarts/pie.vue index 3ad8db6..1bbfb93 100644 --- a/src/components/echarts/pie.vue +++ b/src/components/echarts/pie.vue @@ -25,12 +25,12 @@ tooltip: { trigger: 'item', }, - color: ['rgb(40, 184, 228)', '#ccc'], + color: ['#3d7eff', '#ccc'], legend: { orient: 'vertical', right: '0', - bottom: '50%', - itemGap: 20, + bottom: '40%', + itemGap: 10, }, graphic: { type: 'text', @@ -95,6 +95,6 @@ .bars_w { width: 100%; height: 90%; - transform: translateX(-25%); + transform: translate(-10%, -30%); } diff --git a/src/settings.ts b/src/settings.ts index ae5c3f5..6f8b597 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -17,6 +17,7 @@ baseOn: 'backend', menuMode: 'head', showIcon: true, + switchMainMenuAndPageJump: true, enableSubMenuCollapseButton: true, }, toolbar: { diff --git a/src/api/device/standard.ts b/src/api/device/standard.ts index 6a6d694..4f0d99c 100644 --- a/src/api/device/standard.ts +++ b/src/api/device/standard.ts @@ -27,3 +27,31 @@ data, }) } + +// 详情信息 +export function getStandardListDetail(data: object) { + return request({ + url: `${prefix}/standard/detail`, + method: 'post', + data, + }) +} + +// 更新信息 +export function getStandardLisUpdate(data: object) { + return request({ + url: `${prefix}/standard/update`, + method: 'post', + data, + }) +} + +// 获取部门信息 +export function getUsersDept(data: object) { + return request({ + url: `/meter/organize/listPage?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} + diff --git a/src/components.d.ts b/src/components.d.ts index 0bb0edd..f202da8 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -14,11 +14,11 @@ Auth: typeof import('./components/Auth/index.vue')['default'] AuthAll: typeof import('./components/AuthAll/index.vue')['default'] BatchActionBar: typeof import('./components/BatchActionBar/index.vue')['default'] + BenchCol: typeof import('./components/benchCol/index.vue')['default'] ConditionDrawer: typeof import('./components/drawer/conditionDrawer.vue')['default'] CopyerDrawer: typeof import('./components/drawer/copyerDrawer.vue')['default'] Copyright: typeof import('./components/Copyright/index.vue')['default'] DeptSelect: typeof import('./components/DeptSelect/index.vue')['default'] - Echart: typeof import('./components/Echart/index.vue')['default'] Echarts: typeof import('./components/echarts/index.vue')['default'] Editor: typeof import('./components/Editor/index.vue')['default'] EmployeesDialog: typeof import('./components/dialog/employeesDialog.vue')['default'] @@ -29,6 +29,7 @@ ImagePreview: typeof import('./components/ImagePreview/index.vue')['default'] ImagesUpload: typeof import('./components/ImagesUpload/index.vue')['default'] ImageUpload: typeof import('./components/ImageUpload/index.vue')['default'] + LineChart: typeof import('./components/Echart/LineChart.vue')['default'] NodeWrap: typeof import('./components/workFlow/nodeWrap.vue')['default'] NodeWrapBan: typeof import('./components/workFlow/nodeWrapBan.vue')['default'] NormalTable: typeof import('./components/NormalTable/index.vue')['default'] @@ -36,6 +37,7 @@ PageMain: typeof import('./components/PageMain/index.vue')['default'] PcasCascader: typeof import('./components/PcasCascader/index.vue')['default'] Pie: typeof import('./components/echarts/pie.vue')['default'] + PieChart: typeof import('./components/Echart/PieChart.vue')['default'] PromoterDrawer: typeof import('./components/drawer/promoterDrawer.vue')['default'] RoleDialog: typeof import('./components/dialog/roleDialog.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] diff --git a/src/components/Echart/LineChart.vue b/src/components/Echart/LineChart.vue new file mode 100644 index 0000000..3fec782 --- /dev/null +++ b/src/components/Echart/LineChart.vue @@ -0,0 +1,350 @@ + + + + + diff --git a/src/components/Echart/PieChart.vue b/src/components/Echart/PieChart.vue new file mode 100644 index 0000000..032ee81 --- /dev/null +++ b/src/components/Echart/PieChart.vue @@ -0,0 +1,270 @@ + + + + + diff --git a/src/components/Echart/echart-interface.ts b/src/components/Echart/echart-interface.ts new file mode 100644 index 0000000..e677f65 --- /dev/null +++ b/src/components/Echart/echart-interface.ts @@ -0,0 +1,220 @@ +import type { LinearGradientObject } from 'echarts' +// 折线数据格式 +export interface lineDataI { + name: string // 轴线名称 + data: string[] | number[] // 数值 + color?: string // 颜色 +} + +// 饼图数据格式 +export interface pieDataI { + name: string // 分类名称 + value: number // 分类值 +} +// 标题配置 +export interface titleOption { + title?: { + show?: boolean // 是否显示标题 + left?: number | string // 上边距 + right?: number | string // 右边距 + bottom?: number | string // 下边距 + top?: number | string // 顶部边距 + text: string // 标题 + } +} + +// 网格配置 +export interface gridOption { + grid?: { + show?: boolean // 是否显示直角坐标系网格 + left?: number | string // 上边距 + right?: number | string // 右边距 + bottom?: number | string // 下边距 + top?: number | string // 顶部边距 + containLabel?: boolean // grid区域是否包含坐标轴的刻度标签 + } +} +// 图例 +export interface legendOption { + legend?: { + show?: boolean + icon?: string // 图形样式 + orient?: string // 图例方向 + align?: string // 图例标记和文本的对齐,默认自动 + left?: number | string // 上边距 + right?: number | string // 右边距 + bottom?: number | string // 下边距 + top?: number | string // 顶部边距 + padding?: number | [number, number] | [number, number, number, number] // 内边距 + data?: string[] // 数值 + itemWidth?: number // 图例标记宽 + itemHeight?: number // 图例标记高 + itemStyle?: { // 图例标记样式 + decal?: string // 贴花图案 + } + } +} +// 提示框 +export interface tooltipOption { + tooltip: { + show?: boolean + trigger: 'axis' | 'item' | 'none' // 触发类型 + textStyle: { // 浮层的文本样式 + color?: string // 文字颜色,默认白色 + fontSize?: number // 文字大小, 默认14 + } + axisPointer?: { // 坐标轴指示器 + type: 'cross' | 'line' | 'shadow' | 'none' + label: { + show?: boolean // axisPointer为cross时默认显示,其他默认不显示 + fontSize?: number // 文字大小,默认14 + } + } + formatter?: string + valueFormatter?: (value: number | string) => string // 数值显示部分格式化回调函数 + } +} + +// x轴 +export interface xAxisOption { + type: string // 'category' | 'value' | 'time' | 'log' + name?: string + boundaryGap?: boolean | string[] + data?: Array // 类目数据,在类目轴(type=category)中有效 + axisLine?: { // 坐标轴线 + show?: boolean + lineStyle?: { + color?: string // 轴线的颜色 + width?: number // 轴线宽度,默认1 + } + } + nameTextStyle?: { // 坐标轴名称的文字样式。 + color?: string + fontSize?: number // 默认12 + verticalAlign: 'auto' | 'top' | 'middle' | 'bottom' // 文字垂直对齐方式 + } + axisLabel?: { // 坐标轴刻度标签 + color?: string // X轴名称颜色 + fontSize?: number // + } + splitLine: { // 坐标轴在 grid 区域中的分隔线 + show: boolean + interval?: string | number | ((index: number, value: string) => boolean) // 坐标轴分隔线的显示间隔 + lineStyle?: { + color?: string | Array + type?: string // 'dashed' | 'solid' | 'dotted' + shadowBlur?: number // 图形阴影的模糊大小 + shadowColor?: string // 阴影颜色 + shadowOffsetX?: number // 阴影水平方向的偏移距离 + shadowOffsetY?: number // 阴影垂直方向的偏移距离 + } + opacity?: number // 透明度,默认1 + } +} + +// Y轴 +export interface yAxisOption { + type: string // 'category' | 'value' | 'time' | 'log' + name?: string + boundaryGap?: boolean | string[] + data?: Array // 类目数据,在类目轴(type=category)中有效 + axisLine?: { // 坐标轴线 + show?: boolean + lineStyle?: { + color?: string // 轴线的颜色 + width?: number // 轴线宽度,默认1 + } + } + nameTextStyle?: { // 坐标轴名称的文字样式。 + color?: string + fontSize?: number // 默认12 + verticalAlign: 'auto' | 'top' | 'middle' | 'bottom' // 文字垂直对齐方式 + } + axisLabel?: { // 坐标轴刻度标签 + color?: string // X轴名称颜色 + fontSize?: number // + } + splitLine: { // 坐标轴在 grid 区域中的分隔线 + show?: boolean + interval?: string | number | ((index: number, value: string) => boolean) // 坐标轴分隔线的显示间隔 + lineStyle: { + color?: string | Array + type?: string // 'dashed' | 'solid' | 'dotted' + shadowBlur?: number // 图形阴影的模糊大小 + shadowColor?: string // 阴影颜色 + shadowOffsetX?: number // 阴影水平方向的偏移距离 + shadowOffsetY?: number // 阴影垂直方向的偏移距离 + } + opacity?: number // 透明度,默认1 + } +} + +// 折线series配置项 +export interface lineSeriesOption { + name?: string // 系列名称 + type: 'line' + symbol?: string | Function // 标记的图形 'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow', 'none' + smooth?: boolean // 曲线平滑设置, 默认false + itemStyle?: { // 折线拐点样式 + color?: string // 图形的颜色 + borderColor?: string // 图形的描边颜色 + borderWidth?: number // 描边线宽。默认0,无描边。 + shadowBlur?: number // 图形阴影的模糊大小 + shadowColor?: string // 阴影颜色 + shadowOffsetX?: number // 阴影水平方向的偏移距离 + shadowOffsetY?: number // 阴影垂直方向的偏移距离 + } + lineStyle?: { // 线条样式 + width: number // 线条宽度,默认2 + color?: string // 线条颜色, 默认#000 + type?: 'solid' | 'dashed' | 'dotted' // 默认solid + } + areaStyle?: { // 区域填充样式 + color?: string | LinearGradientObject // 填充颜色 + } + data: number[] | string[] +} +// 饼图series配置项 +export interface pieSeriesOption { + name?: string // 系列名称 + type: 'pie' + animationType?: string// 沿圆弧展开效果 expansion|scale + avoidLabelOverlap?: boolean // 是否启用防止标签重叠策略 + roseType?: string | boolean // 玫瑰图类型 + radius?: string[] // 饼图的半径[内半径,外半径] + center?: [string, string] // 圆心坐标[横坐标,纵坐标] + startAngle?: number // 开始的角度 //起始角度,支持范围[0, 360]。 + label?: { // 饼图图形上的文本标签 + show?: boolean // 是否显示 + position?: string // 标签位置 + fontSize?: number // 文字大小,默认12 + fontWeight?: string // 文字粗细 + lineHeight?: number // 行高 + formatter?: string | Function // 标签内容格式器 + rich?: object // 富文本样式 + emphasis?: { // 高亮状态的扇区和标签样式 + show?: boolean + textStyle: { + color?: string + fontSize?: number + fontWeight?: string + } + } + } + labelLine?: { // 视觉引导线 + show?: boolean + } + data: pieDataI[] +} +// 折线图配置项 +export interface lineOption extends titleOption, gridOption, legendOption, tooltipOption { + xAxis: xAxisOption | xAxisOption[] + yAxis: yAxisOption | yAxisOption[] + series: lineSeriesOption[] +} +// 饼图配置项 +export interface pieOption extends titleOption, gridOption, legendOption, tooltipOption { + color?: string[] + series: pieSeriesOption[] +} + diff --git a/src/components/Echart/index.vue b/src/components/Echart/index.vue deleted file mode 100644 index 9efe188..0000000 --- a/src/components/Echart/index.vue +++ /dev/null @@ -1,55 +0,0 @@ - - - - - diff --git a/src/components/Echart/theme.json b/src/components/Echart/theme.json index 58a1f46..365f766 100644 --- a/src/components/Echart/theme.json +++ b/src/components/Echart/theme.json @@ -255,7 +255,7 @@ "axisLabel": { "show": true, "textStyle": { - "color": "#fff" + "color": "#222" } }, "splitLine": { @@ -292,7 +292,7 @@ "axisLabel": { "show": true, "textStyle": { - "color": "#fff" + "color": "#333" } }, "splitLine": { @@ -399,7 +399,7 @@ }, "legend": { "textStyle": { - "color": "#fff" + "color": "#333" } }, "tooltip": { diff --git a/src/components/Echart/utils.ts b/src/components/Echart/utils.ts new file mode 100644 index 0000000..0acd088 --- /dev/null +++ b/src/components/Echart/utils.ts @@ -0,0 +1,38 @@ +/** + * 格式化颜色 + * @param value 颜色值 #aaa格式或rgb格式 + * @returns 颜色值 + */ +export function formatColor(value: string): string { + const rgbReg = /((2[0-4]\\d|25[0-5]|[01]?[0-9]?[0-9]?)[\\s]*,){2}[\\s]*(2[0-4]\\d|25[0-5]|[0-1]?[0-9]?[0-9])$/ + if (value.startsWith('#')) { // #号开头的颜色值 + return value + } + else if (rgbReg.test(value)) { // 数字开头的颜色值 + return `rgb(${value})` + } + else { + return '' + } +} + +/** + * 获取某颜色的透明度颜色 + * @param color 颜色 + * @param alpha 透明度 + * @returns 透明度颜色 + */ +export function getAlphaColor(color: string, alpha: number): string { + const rgbReg = /((2[0-4]\\d|25[0-5]|[01]?[0-9]?[0-9]?)[\\s]*,){2}[\\s]*(2[0-4]\\d|25[0-5]|[0-1]?[0-9]?[0-9])$/ + if (color.startsWith('#')) { // #号开头的颜色值 + let alpha2 = Math.floor(alpha * 255) + alpha2 = alpha > 255 ? 255 : alpha2 + return color + alpha2.toString(16) // 转换为16进制 + } + else if (rgbReg.test(color)) { // 数字开头的颜色值 + return `rgba(${color}, ${alpha})` + } + else { + return '' + } +} diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index 4c53275..2b110cb 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -165,7 +165,7 @@
+// 逻辑代码 +const props = defineProps({ + title: { + type: String, + default: '', + }, + pathUrl: { + type: String, + default: '', + }, + width: { + type: String, + default: '', + }, + height: { + type: String, + default: '', + }, +}) + + + + + + diff --git a/src/components/echarts/index.vue b/src/components/echarts/index.vue index 1f6f6aa..c385dae 100644 --- a/src/components/echarts/index.vue +++ b/src/components/echarts/index.vue @@ -107,7 +107,7 @@ symbolSize: 2, // 拐点大小 // 折线条的样式 lineStyle: { - color: '#58abf0', + color: '#3d7eff', }, // 折线拐点的样式 itemStyle: { @@ -158,6 +158,6 @@ diff --git a/src/components/echarts/pie.vue b/src/components/echarts/pie.vue index 3ad8db6..1bbfb93 100644 --- a/src/components/echarts/pie.vue +++ b/src/components/echarts/pie.vue @@ -25,12 +25,12 @@ tooltip: { trigger: 'item', }, - color: ['rgb(40, 184, 228)', '#ccc'], + color: ['#3d7eff', '#ccc'], legend: { orient: 'vertical', right: '0', - bottom: '50%', - itemGap: 20, + bottom: '40%', + itemGap: 10, }, graphic: { type: 'text', @@ -95,6 +95,6 @@ .bars_w { width: 100%; height: 90%; - transform: translateX(-25%); + transform: translate(-10%, -30%); } diff --git a/src/settings.ts b/src/settings.ts index ae5c3f5..6f8b597 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -17,6 +17,7 @@ baseOn: 'backend', menuMode: 'head', showIcon: true, + switchMainMenuAndPageJump: true, enableSubMenuCollapseButton: true, }, toolbar: { diff --git a/src/views/device/standardEquipment/components/standardListAdd.vue b/src/views/device/standardEquipment/components/standardListAdd.vue index e7c5f86..483b6ad 100644 --- a/src/views/device/standardEquipment/components/standardListAdd.vue +++ b/src/views/device/standardEquipment/components/standardListAdd.vue @@ -4,7 +4,7 @@ import type { FormInstance, UploadProps, UploadUserFile } from 'element-plus' import { getStaffList } from '@/api/measure/person' import { getTypeSelect } from '@/api/system/price' -import { getStandardListAdd } from '@/api/device/standard' +import { getStandardLisUpdate, getStandardListAdd, getStandardListDetail, getUsersDept } from '@/api/device/standard' import { UploadFile } from '@/api/measure/file' const props = defineProps({ infoId: { @@ -29,7 +29,7 @@ contactInfo: '', createTime: null, createUser: null, - id: null, + id: '', isDel: null, laboratoryOwner: null, laboratoryOwnerContact: null, @@ -61,12 +61,7 @@ updateTime: null, version: null, }) -const checkTypeOptions = ref([ - { name: '国家', id: 0, value: 0 }, - { name: '国防', id: 1, value: 1 }, - { name: '二级', id: 2, value: 2 }, - { name: '标准装置', id: 3, value: 3 }, -]) +const checkTypeOptions = ref([]) const transmitRangeOptions = ref([ { name: '国家级', id: 0, value: 0 }, { name: '省级', id: 1, value: 1 }, @@ -79,6 +74,8 @@ const standardManagerStateList = ref([]) // 管理状态下拉框 const standardLevelList = ref([]) // 标准等级下拉框 const transmitRangeList = ref([]) // 传递范围下拉框 +// 标准所在部门下拉框 +const standardUsersDeptList = ref([]) // 获取下拉框 const getSelectList = (code: string) => { getTypeSelect(code).then((res) => { @@ -94,12 +91,30 @@ else if (code === 'transmitRange') { transmitRangeList.value = res.data } + else if (code === 'standardCategory') { + checkTypeOptions.value = res.data + } }) } getSelectList('measureMajor') // 获取计量专业下拉框 getSelectList('standardManagerState') // 获取管理状态下拉框 getSelectList('standardLevel') // 获取标准等级下拉框 getSelectList('transmitRange') // 获取传递范围下拉框 +getSelectList('standardCategory') // 获取类别下拉框 +// 获取部门信息 +getUsersDept({ + createTime: '', + director: '', + meterMajor: '', + organizeName: '', + organizeNo: '', + organizeType: '2', + pdeptId: null, + offset: 1, + limit: 999999, +}).then((res) => { + standardUsersDeptList.value = res.data.rows +}) // 获取到标准负责人数组 const getStandardOwnerOptions = () => { const params = { @@ -193,9 +208,33 @@ ) } } +// 编辑获取详情的提交按钮 +const submitFormDetail = () => { + if (props.buttonType === '编辑') { + formInline.value.id = props.infoId + formInline.value.laboratoryOwner = null + getStandardLisUpdate(formInline.value).then((res) => { + if (res.code === 200) { + close() + } + }) + } + else { + // 打印 + const printObj = ref({ + id: 'print', // 需要打印元素的id + popTitle: '测量标准装置', // 打印配置页上方的标题 + extraHead: '', // 最上方的头部文字,附加在head标签上的额外标签,使用逗号分割 + preview: false, // 是否启动预览模式,默认是false + standard: '', + extarCss: '', + }) + } +} // 提交 const submitForm = async (formEl: FormInstance | undefined) => { if (!formEl) { return } + if (props.buttonType === '详情') { return submitFormDetail() } await formEl.validate((valid, fields) => { if (valid) { ElMessageBox.confirm( @@ -213,11 +252,30 @@ close() } }) - : '' + : submitFormDetail() }) } }) } +// 标准实验室发生改变 +const changeDeptList = (row: object) => { + formInline.value.laboratoryOwnerContact = row.phone + formInline.value.laboratoryOwnerName = row.director +} +// 标准实验室清空时 +const clearDeptList = () => { + formInline.value.laboratoryOwnerContact = null + formInline.value.laboratoryOwnerName = null +} +// 获取详情信息 +const getInfo = () => { + getStandardListDetail({ id: props.infoId }).then((res) => { + formInline.value = res.data + }) +} +if (props.buttonType !== '') { + getInfo() +}