添加页面补招功能

This commit is contained in:
GGJ
2025-04-30 16:00:26 +08:00
parent dabb960d09
commit 81726cde2d
15 changed files with 7778 additions and 576 deletions

View File

@@ -1,23 +1,43 @@
<template> <template>
<div :style="{ height: tableStore.table.height }"> <div :style="{ height: tableStore.table.height }">
<vxe-table ref="tableRef" height="auto" :data="tableStore.table.data" v-loading="tableStore.table.loading" <vxe-table
v-bind="Object.assign({}, defaultAttribute, $attrs)" @checkbox-all="selectChangeEvent" ref="tableRef"
@checkbox-change="selectChangeEvent" :showOverflow="showOverflow" @sort-change="handleSortChange"> height="auto"
:data="tableStore.table.data"
v-loading="tableStore.table.loading"
v-bind="Object.assign({}, defaultAttribute, $attrs)"
@checkbox-all="selectChangeEvent"
@checkbox-change="selectChangeEvent"
:showOverflow="showOverflow"
@sort-change="handleSortChange"
>
<!-- Column 组件内部是 el-table-column --> <!-- Column 组件内部是 el-table-column -->
<template v-if="isGroup"> <template v-if="isGroup">
<GroupColumn :column="tableStore.table.column" /> <GroupColumn :column="tableStore.table.column" />
</template> </template>
<template v-else> <template v-else>
<Column :attr="item" :key="key + '-column'" v-for="(item, key) in tableStore.table.column" <Column
:tree-node="item.treeNode"> :attr="item"
:key="key + '-column'"
v-for="(item, key) in tableStore.table.column"
:tree-node="item.treeNode"
>
<!-- tableStore 预设的列 render 方案 --> <!-- tableStore 预设的列 render 方案 -->
<template v-if="item.render" #default="scope"> <template v-if="item.render" #default="scope">
<FieldRender :field="item" :row="scope.row" :column="scope.column" :index="scope.rowIndex" :key="key + <FieldRender
'-' + :field="item"
item.render + :row="scope.row"
'-' + :column="scope.column"
(item.field ? '-' + item.field + '-' + scope.row[item.field] : '') :index="scope.rowIndex"
" /> :key="
key +
'-' +
item.render +
'-' +
(item.field ? '-' + item.field + '-' + scope.row[item.field] : '')
"
/>
</template> </template>
</Column> </Column>
</template> </template>
@@ -26,11 +46,16 @@
</div> </div>
<div v-if="tableStore.showPage" class="table-pagination"> <div v-if="tableStore.showPage" class="table-pagination">
<el-pagination :currentPage="tableStore.table.params!.pageNum" :page-size="tableStore.table.params!.pageSize" <el-pagination
:page-sizes="pageSizes" background :currentPage="tableStore.table.params!.pageNum"
:page-size="tableStore.table.params!.pageSize"
:page-sizes="pageSizes"
background
:layout="config.layout.shrink ? 'prev, next, jumper' : 'sizes,total, ->, prev, pager, next, jumper'" :layout="config.layout.shrink ? 'prev, next, jumper' : 'sizes,total, ->, prev, pager, next, jumper'"
:total="tableStore.table.total" @size-change="onTableSizeChange" :total="tableStore.table.total"
@current-change="onTableCurrentChange"></el-pagination> @size-change="onTableSizeChange"
@current-change="onTableCurrentChange"
></el-pagination>
</div> </div>
<slot name="footer"></slot> <slot name="footer"></slot>
</template> </template>
@@ -112,26 +137,24 @@ const handleSortChange = ({ column, order }: { column: TableColumn; order: 'asc'
watch( watch(
() => tableStore.table.allFlag, () => tableStore.table.allFlag,
newVal => { newVal => {
if (tableStore.table.allFlag) { if (tableStore.table.allFlag) {
tableRef.value?.exportData({ tableRef.value?.exportData({
filename:tableStore.table.filename|| document.querySelectorAll('.ba-nav-tab.active')[0].textContent || '', // 文件名字 filename:
tableStore.table.filename || document.querySelectorAll('.ba-nav-tab.active')[0].textContent || '', // 文件名字
sheetName: 'Sheet1', sheetName: 'Sheet1',
type: 'xlsx', //导出文件类型 xlsx 和 csv type: 'xlsx', //导出文件类型 xlsx 和 csv
useStyle: true, useStyle: true,
data: tableStore.table.allData, // 数据源 // 过滤那个字段导出 data: tableStore.table.allData, // 数据源 // 过滤那个字段导出
columnFilterMethod: function (column: any) { columnFilterMethod: function (column: any) {
return !(
return !(column.column.title === undefined || column.column.title === '序号' || column.column.title === '操作') column.column.title === undefined ||
column.column.title === '序号' ||
column.column.title === '操作'
)
} }
}) })
tableStore.table.allFlag = false tableStore.table.allFlag = false
} }
} }
) )
watch( watch(
@@ -169,6 +192,5 @@ defineExpose({
border-right: 1px solid #e4e7e9; border-right: 1px solid #e4e7e9;
border-bottom: 1px solid #e4e7e9; border-bottom: 1px solid #e4e7e9;
} }
</style> </style>
<!-- @/components/table/column/GroupColumn.vue@/components/table/column/GroupColumn.vue --> <!-- @/components/table/column/GroupColumn.vue@/components/table/column/GroupColumn.vue -->

View File

@@ -1,4 +1,4 @@
import {toNumber} from 'lodash-es' import { toNumber } from 'lodash-es'
/** /**
* *
@@ -7,14 +7,14 @@ import {toNumber} from 'lodash-es'
* @returns any * @returns any
*/ */
export const withInstall = <T>(component: T, alias?: string) => { export const withInstall = <T>(component: T, alias?: string) => {
const comp = component as any const comp = component as any
comp.install = (app: any) => { comp.install = (app: any) => {
app.component(comp.name || comp.displayName, component) app.component(comp.name || comp.displayName, component)
if (alias) { if (alias) {
app.config.globalProperties[alias] = component app.config.globalProperties[alias] = component
}
} }
} return component as T & Plugin
return component as T & Plugin
} }
/** /**
@@ -22,7 +22,7 @@ export const withInstall = <T>(component: T, alias?: string) => {
* @returns 字符串下划线 * @returns 字符串下划线
*/ */
export const humpToUnderline = (str: string): string => { export const humpToUnderline = (str: string): string => {
return str.replace(/([A-Z])/g, '-$1').toLowerCase() return str.replace(/([A-Z])/g, '-$1').toLowerCase()
} }
/** /**
@@ -30,21 +30,21 @@ export const humpToUnderline = (str: string): string => {
* @returns 字符串驼峰 * @returns 字符串驼峰
*/ */
export const underlineToHump = (str: string): string => { export const underlineToHump = (str: string): string => {
if (!str) return '' if (!str) return ''
return str.replace(/\-(\w)/g, (_, letter: string) => { return str.replace(/\-(\w)/g, (_, letter: string) => {
return letter.toUpperCase() return letter.toUpperCase()
}) })
} }
/** /**
* 驼峰转横杠 * 驼峰转横杠
*/ */
export const humpToDash = (str: string): string => { export const humpToDash = (str: string): string => {
return str.replace(/([A-Z])/g, '-$1').toLowerCase() return str.replace(/([A-Z])/g, '-$1').toLowerCase()
} }
export const setCssVar = (prop: string, val: any, dom = document.documentElement) => { export const setCssVar = (prop: string, val: any, dom = document.documentElement) => {
dom.style.setProperty(prop, val) dom.style.setProperty(prop, val)
} }
/** /**
@@ -54,22 +54,22 @@ export const setCssVar = (prop: string, val: any, dom = document.documentElement
*/ */
// eslint-disable-next-line // eslint-disable-next-line
export const findIndex = <T = Recordable>(ary: Array<T>, fn: Fn): number => { export const findIndex = <T = Recordable>(ary: Array<T>, fn: Fn): number => {
if (ary.findIndex) { if (ary.findIndex) {
return ary.findIndex(fn) return ary.findIndex(fn)
}
let index = -1
ary.some((item: T, i: number, ary: Array<T>) => {
const ret: T = fn(item, i, ary)
if (ret) {
index = i
return ret
} }
}) let index = -1
return index ary.some((item: T, i: number, ary: Array<T>) => {
const ret: T = fn(item, i, ary)
if (ret) {
index = i
return ret
}
})
return index
} }
export const trim = (str: string) => { export const trim = (str: string) => {
return str.replace(/(^\s*)|(\s*$)/g, '') return str.replace(/(^\s*)|(\s*$)/g, '')
} }
/** /**
@@ -77,81 +77,75 @@ export const trim = (str: string) => {
* @param {String} fmt 需要转换的格式 如 yyyy-MM-dd、yyyy-MM-dd HH:mm:ss * @param {String} fmt 需要转换的格式 如 yyyy-MM-dd、yyyy-MM-dd HH:mm:ss
*/ */
export function formatTime(time: Date | number | string, fmt: string) { export function formatTime(time: Date | number | string, fmt: string) {
if (!time) return '' if (!time) return ''
else { else {
const date = new Date(time) const date = new Date(time)
const o = { const o = {
'M+': date.getMonth() + 1, 'M+': date.getMonth() + 1,
'd+': date.getDate(), 'd+': date.getDate(),
'H+': date.getHours(), 'H+': date.getHours(),
'm+': date.getMinutes(), 'm+': date.getMinutes(),
's+': date.getSeconds(), 's+': date.getSeconds(),
'q+': Math.floor((date.getMonth() + 3) / 3), 'q+': Math.floor((date.getMonth() + 3) / 3),
S: date.getMilliseconds() S: date.getMilliseconds()
}
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
}
for (const k in o) {
if (new RegExp('(' + k + ')').test(fmt)) {
fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length))
}
}
return fmt
} }
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
}
for (const k in o) {
if (new RegExp('(' + k + ')').test(fmt)) {
fmt = fmt.replace(
RegExp.$1,
RegExp.$1.length === 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length)
)
}
}
return fmt
}
} }
/** /**
* 生成随机字符串 * 生成随机字符串
*/ */
export function toAnyString() { export function toAnyString() {
const str: string = 'xxxxx-xxxxx-4xxxx-yxxxx-xxxxx'.replace(/[xy]/g, (c: string) => { const str: string = 'xxxxx-xxxxx-4xxxx-yxxxx-xxxxx'.replace(/[xy]/g, (c: string) => {
const r: number = (Math.random() * 16) | 0 const r: number = (Math.random() * 16) | 0
const v: number = c === 'x' ? r : (r & 0x3) | 0x8 const v: number = c === 'x' ? r : (r & 0x3) | 0x8
return v.toString() return v.toString()
}) })
return str return str
} }
/** /**
* 首字母大写 * 首字母大写
*/ */
export function firstUpperCase(str: string) { export function firstUpperCase(str: string) {
return str.toLowerCase().replace(/( |^)[a-z]/g, (L) => L.toUpperCase()) return str.toLowerCase().replace(/( |^)[a-z]/g, L => L.toUpperCase())
} }
export const generateUUID = () => { export const generateUUID = () => {
if (typeof crypto === 'object') { if (typeof crypto === 'object') {
if (typeof crypto.randomUUID === 'function') { if (typeof crypto.randomUUID === 'function') {
return crypto.randomUUID() return crypto.randomUUID()
}
if (typeof crypto.getRandomValues === 'function' && typeof Uint8Array === 'function') {
const callback = (c: any) => {
const num = Number(c)
return (num ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (num / 4)))).toString(16)
}
return '10000000-1000-4000-8000-100000000000'.replace(/[018]/g, callback)
}
} }
if (typeof crypto.getRandomValues === 'function' && typeof Uint8Array === 'function') { let timestamp = new Date().getTime()
const callback = (c: any) => { let performanceNow = (typeof performance !== 'undefined' && performance.now && performance.now() * 1000) || 0
const num = Number(c) return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
return (num ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (num / 4)))).toString( let random = Math.random() * 16
16 if (timestamp > 0) {
) random = (timestamp + random) % 16 | 0
} timestamp = Math.floor(timestamp / 16)
return '10000000-1000-4000-8000-100000000000'.replace(/[018]/g, callback) } else {
} random = (performanceNow + random) % 16 | 0
} performanceNow = Math.floor(performanceNow / 16)
let timestamp = new Date().getTime() }
let performanceNow = return (c === 'x' ? random : (random & 0x3) | 0x8).toString(16)
(typeof performance !== 'undefined' && performance.now && performance.now() * 1000) || 0 })
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
let random = Math.random() * 16
if (timestamp > 0) {
random = (timestamp + random) % 16 | 0
timestamp = Math.floor(timestamp / 16)
} else {
random = (performanceNow + random) % 16 | 0
performanceNow = Math.floor(performanceNow / 16)
}
return (c === 'x' ? random : (random & 0x3) | 0x8).toString(16)
})
} }
/** /**
@@ -163,13 +157,13 @@ export const generateUUID = () => {
*/ */
// @ts-ignore // @ts-ignore
export const fileSizeFormatter = (row, column, cellValue) => { export const fileSizeFormatter = (row, column, cellValue) => {
const fileSize = cellValue const fileSize = cellValue
const unitArr = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] const unitArr = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
const srcSize = parseFloat(fileSize) const srcSize = parseFloat(fileSize)
const index = Math.floor(Math.log(srcSize) / Math.log(1024)) const index = Math.floor(Math.log(srcSize) / Math.log(1024))
const size = srcSize / Math.pow(1024, index) const size = srcSize / Math.pow(1024, index)
const sizeStr = size.toFixed(2) //保留的小数位数 const sizeStr = size.toFixed(2) //保留的小数位数
return sizeStr + ' ' + unitArr[index] return sizeStr + ' ' + unitArr[index]
} }
/** /**
@@ -178,16 +172,16 @@ export const fileSizeFormatter = (row, column, cellValue) => {
* @param source 源对象 * @param source 源对象
*/ */
export const copyValueToTarget = (target: any, source: any) => { export const copyValueToTarget = (target: any, source: any) => {
const newObj = Object.assign({}, target, source) const newObj = Object.assign({}, target, source)
// 删除多余属性 // 删除多余属性
Object.keys(newObj).forEach((key) => { Object.keys(newObj).forEach(key => {
// 如果不是target中的属性则删除 // 如果不是target中的属性则删除
if (Object.keys(target).indexOf(key) === -1) { if (Object.keys(target).indexOf(key) === -1) {
delete newObj[key] delete newObj[key]
} }
}) })
// 更新目标对象值 // 更新目标对象值
Object.assign(target, newObj) Object.assign(target, newObj)
} }
/** /**
@@ -196,9 +190,9 @@ export const copyValueToTarget = (target: any, source: any) => {
* @param urlStr 链接地址,默认为当前浏览器的地址 * @param urlStr 链接地址,默认为当前浏览器的地址
*/ */
export const getUrlValue = (key: string, urlStr: string = location.href): string => { export const getUrlValue = (key: string, urlStr: string = location.href): string => {
if (!urlStr || !key) return '' if (!urlStr || !key) return ''
const url = new URL(decodeURIComponent(urlStr)) const url = new URL(decodeURIComponent(urlStr))
return url.searchParams.get(key) ?? '' return url.searchParams.get(key) ?? ''
} }
/** /**
@@ -207,7 +201,7 @@ export const getUrlValue = (key: string, urlStr: string = location.href): string
* @param urlStr 链接地址,默认为当前浏览器的地址 * @param urlStr 链接地址,默认为当前浏览器的地址
*/ */
export const getUrlNumberValue = (key: string, urlStr: string = location.href): number => { export const getUrlNumberValue = (key: string, urlStr: string = location.href): number => {
return toNumber(getUrlValue(key, urlStr)) return toNumber(getUrlValue(key, urlStr))
} }
/** /**
@@ -216,7 +210,7 @@ export const getUrlNumberValue = (key: string, urlStr: string = location.href):
* @param order 顺序 * @param order 顺序
*/ */
export const buildSortingField = ({ prop, order }) => { export const buildSortingField = ({ prop, order }) => {
return { field: prop, order: order === 'ascending' ? 'asc' : 'desc' } return { field: prop, order: order === 'ascending' ? 'asc' : 'desc' }
} }
// ========== NumberUtils 数字方法 ========== // ========== NumberUtils 数字方法 ==========
@@ -228,14 +222,14 @@ export const buildSortingField = ({ prop, order }) => {
* @return 求和结果,默认为 0 * @return 求和结果,默认为 0
*/ */
export const getSumValue = (values: number[]): number => { export const getSumValue = (values: number[]): number => {
return values.reduce((prev, curr) => { return values.reduce((prev, curr) => {
const value = Number(curr) const value = Number(curr)
if (!Number.isNaN(value)) { if (!Number.isNaN(value)) {
return prev + curr return prev + curr
} else { } else {
return prev return prev
} }
}, 0) }, 0)
} }
// ========== 通用金额方法 ========== // ========== 通用金额方法 ==========
@@ -245,9 +239,9 @@ export const getSumValue = (values: number[]): number => {
* @param num * @param num
*/ */
export const formatToFraction = (num: number | string | undefined): string => { export const formatToFraction = (num: number | string | undefined): string => {
if (typeof num === 'undefined') return '0.00' if (typeof num === 'undefined') return '0.00'
const parsedNumber = typeof num === 'string' ? parseFloat(num) : num const parsedNumber = typeof num === 'string' ? parseFloat(num) : num
return (parsedNumber / 100.0).toFixed(2) return (parsedNumber / 100.0).toFixed(2)
} }
/** /**
@@ -258,25 +252,25 @@ export const formatToFraction = (num: number | string | undefined): string => {
*/ */
// TODO @芋艿:看看怎么融合掉 // TODO @芋艿:看看怎么融合掉
export const floatToFixed2 = (num: number | string | undefined): string => { export const floatToFixed2 = (num: number | string | undefined): string => {
let str = '0.00' let str = '0.00'
if (typeof num === 'undefined') { if (typeof num === 'undefined') {
return str
}
const f = formatToFraction(num)
const decimalPart = f.toString().split('.')[1]
const len = decimalPart ? decimalPart.length : 0
switch (len) {
case 0:
str = f.toString() + '.00'
break
case 1:
str = f.toString() + '0'
break
case 2:
str = f.toString()
break
}
return str return str
}
const f = formatToFraction(num)
const decimalPart = f.toString().split('.')[1]
const len = decimalPart ? decimalPart.length : 0
switch (len) {
case 0:
str = f.toString() + '.00'
break
case 1:
str = f.toString() + '0'
break
case 2:
str = f.toString()
break
}
return str
} }
/** /**
@@ -285,24 +279,24 @@ export const floatToFixed2 = (num: number | string | undefined): string => {
*/ */
// TODO @芋艿:看看怎么融合掉 // TODO @芋艿:看看怎么融合掉
export const convertToInteger = (num: number | string | undefined): number => { export const convertToInteger = (num: number | string | undefined): number => {
if (typeof num === 'undefined') return 0 if (typeof num === 'undefined') return 0
const parsedNumber = typeof num === 'string' ? parseFloat(num) : num const parsedNumber = typeof num === 'string' ? parseFloat(num) : num
// TODO 分转元后还有小数则四舍五入 // TODO 分转元后还有小数则四舍五入
return Math.round(parsedNumber * 100) return Math.round(parsedNumber * 100)
} }
/** /**
* 元转分 * 元转分
*/ */
export const yuanToFen = (amount: string | number): number => { export const yuanToFen = (amount: string | number): number => {
return convertToInteger(amount) return convertToInteger(amount)
} }
/** /**
* 分转元 * 分转元
*/ */
export const fenToYuan = (price: string | number): string => { export const fenToYuan = (price: string | number): string => {
return formatToFraction(price) return formatToFraction(price)
} }
/** /**
@@ -312,10 +306,10 @@ export const fenToYuan = (price: string | number): string => {
* @param reference 对比数值 * @param reference 对比数值
*/ */
export const calculateRelativeRate = (value?: number, reference?: number) => { export const calculateRelativeRate = (value?: number, reference?: number) => {
// 防止除0 // 防止除0
if (!reference) return 0 if (!reference) return 0
return ((100 * ((value || 0) - reference)) / reference).toFixed(0) return ((100 * ((value || 0) - reference)) / reference).toFixed(0)
} }
// ========== ERP 专属方法 ========== // ========== ERP 专属方法 ==========
@@ -333,17 +327,17 @@ const ERP_PRICE_DIGIT = 2
* @return 格式化后的数量 * @return 格式化后的数量
*/ */
export const erpNumberFormatter = (num: number | string | undefined, digit: number) => { export const erpNumberFormatter = (num: number | string | undefined, digit: number) => {
if (num == null) { if (num == null) {
return '' return ''
} }
if (typeof num === 'string') { if (typeof num === 'string') {
num = parseFloat(num) num = parseFloat(num)
} }
// 如果非 number则直接返回空串 // 如果非 number则直接返回空串
if (isNaN(num)) { if (isNaN(num)) {
return '' return ''
} }
return num.toFixed(digit) return num.toFixed(digit)
} }
/** /**
@@ -355,7 +349,7 @@ export const erpNumberFormatter = (num: number | string | undefined, digit: numb
* @return 格式化后的数量 * @return 格式化后的数量
*/ */
export const erpCountInputFormatter = (num: number | string | undefined) => { export const erpCountInputFormatter = (num: number | string | undefined) => {
return erpNumberFormatter(num, ERP_COUNT_DIGIT) return erpNumberFormatter(num, ERP_COUNT_DIGIT)
} }
// noinspection JSCommentMatchesSignature // noinspection JSCommentMatchesSignature
@@ -366,7 +360,7 @@ export const erpCountInputFormatter = (num: number | string | undefined) => {
* @return 格式化后的数量 * @return 格式化后的数量
*/ */
export const erpCountTableColumnFormatter = (_, __, cellValue: any, ___) => { export const erpCountTableColumnFormatter = (_, __, cellValue: any, ___) => {
return erpNumberFormatter(cellValue, ERP_COUNT_DIGIT) return erpNumberFormatter(cellValue, ERP_COUNT_DIGIT)
} }
/** /**
@@ -378,7 +372,7 @@ export const erpCountTableColumnFormatter = (_, __, cellValue: any, ___) => {
* @return 格式化后的数量 * @return 格式化后的数量
*/ */
export const erpPriceInputFormatter = (num: number | string | undefined) => { export const erpPriceInputFormatter = (num: number | string | undefined) => {
return erpNumberFormatter(num, ERP_PRICE_DIGIT) return erpNumberFormatter(num, ERP_PRICE_DIGIT)
} }
// noinspection JSCommentMatchesSignature // noinspection JSCommentMatchesSignature
@@ -389,7 +383,7 @@ export const erpPriceInputFormatter = (num: number | string | undefined) => {
* @return 格式化后的数量 * @return 格式化后的数量
*/ */
export const erpPriceTableColumnFormatter = (_, __, cellValue: any, ___) => { export const erpPriceTableColumnFormatter = (_, __, cellValue: any, ___) => {
return erpNumberFormatter(cellValue, ERP_PRICE_DIGIT) return erpNumberFormatter(cellValue, ERP_PRICE_DIGIT)
} }
/** /**
@@ -400,10 +394,10 @@ export const erpPriceTableColumnFormatter = (_, __, cellValue: any, ___) => {
* @return 总价格。如果有任一为空,则返回 undefined * @return 总价格。如果有任一为空,则返回 undefined
*/ */
export const erpPriceMultiply = (price: number, count: number) => { export const erpPriceMultiply = (price: number, count: number) => {
if (price == null || count == null) { if (price == null || count == null) {
return undefined return undefined
} }
return parseFloat((price * count).toFixed(ERP_PRICE_DIGIT)) return parseFloat((price * count).toFixed(ERP_PRICE_DIGIT))
} }
/** /**
@@ -415,8 +409,8 @@ export const erpPriceMultiply = (price: number, count: number) => {
* @param total 总值 * @param total 总值
*/ */
export const erpCalculatePercentage = (value: number, total: number) => { export const erpCalculatePercentage = (value: number, total: number) => {
if (total === 0) return 0 if (total === 0) return 0
return ((value / total) * 100).toFixed(2) return ((value / total) * 100).toFixed(2)
} }
/** /**
@@ -425,13 +419,34 @@ export const erpCalculatePercentage = (value: number, total: number) => {
* @param areaName 地区名称 * @param areaName 地区名称
*/ */
export const areaReplace = (areaName: string) => { export const areaReplace = (areaName: string) => {
if (!areaName) { if (!areaName) {
return areaName
}
return areaName return areaName
} .replace('维吾尔自治区', '')
return areaName .replace('壮族自治区', '')
.replace('维吾尔自治区', '') .replace('回族自治区', '')
.replace('壮族自治区', '') .replace('自治区', '')
.replace('回族自治区', '') .replace('', '')
.replace('自治区', '') }
.replace('省', '') /**
* bes64解密函数
*
* @param areaName 地区名称
*/
//
export const decryptFromBase64 = (base64Str: string) => {
try {
const binaryStr = atob(base64Str)
const encodedStr = binaryStr
.split('')
.map(char => {
return '%' + ('00' + char.charCodeAt(0).toString(16)).slice(-2)
})
.join('')
return decodeURIComponent(encodedStr)
} catch (error) {
console.error('解密出错:', error)
return null
}
} }

View File

@@ -338,7 +338,7 @@ const change = val => {
treeRef.value!.filter(filterText.value) treeRef.value!.filter(filterText.value)
} }
const edit = (data: any) => { const edit = (data: any) => {
console.log('🚀 ~ edit ~ data:', data) // console.log('🚀 ~ edit ~ data:', data)
processNo.value = data.processNo processNo.value = data.processNo
processId.value = data.id processId.value = data.id
popUps.value = true popUps.value = true

View File

@@ -552,7 +552,7 @@
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item <!-- <el-form-item
class="form-item" class="form-item"
label="进程号:" label="进程号:"
:prop="'deviceParam.' + index + '.processNum'" :prop="'deviceParam.' + index + '.processNum'"
@@ -579,7 +579,7 @@
:value="item" :value="item"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item> -->
<el-form-item <el-form-item
class="form-item" class="form-item"
label="召唤标志:" label="召唤标志:"

View File

@@ -81,7 +81,7 @@
<el-tab-pane :name="0" :lazy="true" label="稳态指标符合性占比表格"> <el-tab-pane :name="0" :lazy="true" label="稳态指标符合性占比表格">
<Table <Table
ref="tableRef" ref="tableRef"
:tree-config="{ transform: true, parentField: 'pid' }" :tree-config="{ transform: true, parentField: 'uPid', rowField: 'uId' }"
:scroll-y="{ enabled: true }" :scroll-y="{ enabled: true }"
v-if="activeName == 0" v-if="activeName == 0"
/> />
@@ -197,10 +197,9 @@ const tableStore = new TableStore({
], ],
loadCallback: () => { loadCallback: () => {
let treeData = [] tableStore.table.data = tree2List(tableStore.table.data, Math.random() * 1000)
treeData = tree2List(tableStore.table.data)
tableStore.table.column[0].title = tableStore.table.params.statisticalType.name tableStore.table.column[0].title = tableStore.table.params.statisticalType.name
tableStore.table.data = JSON.parse(JSON.stringify(treeData))
chartsRef.value && chartsRef.value.getTableStoreParams(tableStore.table.params) chartsRef.value && chartsRef.value.getTableStoreParams(tableStore.table.params)
setTimeout(() => { setTimeout(() => {
activeName.value == 0 && tableRef.value && tableRef.value.getRef().setAllTreeExpand(true) activeName.value == 0 && tableRef.value && tableRef.value.getRef().setAllTreeExpand(true)
@@ -214,18 +213,18 @@ tableStore.table.params.manufacturer = []
tableStore.table.params.loadType = [] tableStore.table.params.loadType = []
tableStore.table.params.serverName = 'harmonicBoot' tableStore.table.params.serverName = 'harmonicBoot'
provide('tableStore', tableStore) provide('tableStore', tableStore)
const tree2List = (list: any, pid?: string) => { const tree2List = (list: any, id?: string) => {
//存储结果的数组 //存储结果的数组
let arr: any = [] let arr: any = []
// 遍历 tree 数组 // 遍历 tree 数组
list.forEach((item: any) => { list.forEach((item: any) => {
// item.comFlag = item.comFlag == null ? 3 : item.comFlag item.uPid = id
item.uId = Math.random() * 1000
item.valueOver == 3.14159 ? 0 : item.valueOver >= 90 ? 1 : item.valueOver && item.valueOver < 90 ? 2 : 3 item.valueOver == 3.14159 ? 0 : item.valueOver >= 90 ? 1 : item.valueOver && item.valueOver < 90 ? 2 : 3
item.pid = pid
// 判断item是否存在children // 判断item是否存在children
if (!item.children) return arr.push(item) if (!item.children) return arr.push(item)
// 函数递归对children数组进行tree2List的转换 // 函数递归对children数组进行tree2List的转换
const children = tree2List(item.children, item.id) const children = tree2List(item.children, item.uId)
// 删除item的children属性 // 删除item的children属性
delete item.children delete item.children
// 把item和children数组添加至结果数组 // 把item和children数组添加至结果数组
@@ -235,6 +234,7 @@ const tree2List = (list: any, pid?: string) => {
// 返回结果数组 // 返回结果数组
return arr return arr
} }
onMounted(() => { onMounted(() => {
tableStore.index() tableStore.index()
}) })

View File

@@ -103,6 +103,9 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</template> </template>
<template #operation>
<el-button type="primary" icon="el-icon-Download" @click="makeUp">补招</el-button>
</template>
</TableHeader> </TableHeader>
</div> </div>
<div class="online_main"> <div class="online_main">
@@ -110,7 +113,8 @@
<el-tab-pane :name="0" :lazy="true" label="数据完整性列表"> <el-tab-pane :name="0" :lazy="true" label="数据完整性列表">
<Table <Table
ref="tableRef" ref="tableRef"
:tree-config="{ transform: true, parentField: 'pid' }" :tree-config="{ transform: true, parentField: 'uPid', rowField: 'uId' }"
:checkbox-config="{ labelField: 'name', }"
:scroll-y="{ enabled: true }" :scroll-y="{ enabled: true }"
v-if="activeName == 0" v-if="activeName == 0"
/> />
@@ -183,7 +187,6 @@ const handleClick = (tab: any, e: any) => {
// } // }
} }
// const datePickerRef = ref()
const tableHeaderRef = ref() const tableHeaderRef = ref()
const tableStore = new TableStore({ const tableStore = new TableStore({
publicHeight: 60, publicHeight: 60,
@@ -195,8 +198,13 @@ const tableStore = new TableStore({
title: formData.value.statisticalType.name, title: formData.value.statisticalType.name,
field: 'name', field: 'name',
align: 'left', align: 'left',
type: 'checkbox',
treeNode: true, treeNode: true,
width: 350, width: 350,
formatter: function (row) {
console.log("🚀 ~ row:", row)
return 123//row.cellValue ? row.cellValue : '/'
}
}, },
{ {
title: '网络参数', title: '网络参数',
@@ -291,9 +299,8 @@ const tableStore = new TableStore({
// tableStore.table.params.searchEndTime = tableHeaderRef.value.datePickerRef.timeValue[1] // tableStore.table.params.searchEndTime = tableHeaderRef.value.datePickerRef.timeValue[1]
}, },
loadCallback: () => { loadCallback: () => {
let treeData = [] tableStore.table.data = tree2List(tableStore.table.data, Math.random() * 1000)
treeData = tree2List(tableStore.table.data)
tableStore.table.data = JSON.parse(JSON.stringify(treeData))
tableStore.table.column[0].title = formData.value.statisticalType.name tableStore.table.column[0].title = formData.value.statisticalType.name
chartsRef.value && chartsRef.value.getTableStoreParams(tableStore.table.params) chartsRef.value && chartsRef.value.getTableStoreParams(tableStore.table.params)
setTimeout(() => { setTimeout(() => {
@@ -301,22 +308,20 @@ const tableStore = new TableStore({
}, 0) }, 0)
} }
}) })
const handleSearch = () => {
formData.value.searchBeginTime = datePickerRef.value.timeValue[0]
formData.value.searchEndTime = datePickerRef.value.timeValue[1]
}
tableStore.table.params.deptIndex = '' tableStore.table.params.deptIndex = ''
tableStore.table.params.statisticalType = [] tableStore.table.params.statisticalType = []
tableStore.table.params.scale = [] tableStore.table.params.scale = []
tableStore.table.params.manufacturer = [] tableStore.table.params.manufacturer = []
tableStore.table.params.loadType = [] tableStore.table.params.loadType = []
provide('tableStore', tableStore) provide('tableStore', tableStore)
const tree2List = (list: any, pid?: string) => { const tree2List = (list: any, id?: string) => {
//存储结果的数组 //存储结果的数组
let arr: any = [] let arr: any = []
// 遍历 tree 数组 // 遍历 tree 数组
list.forEach((item: any) => { list.forEach((item: any) => {
// item.comFlag = item.comFlag == null ? 3 : item.comFlag item.uPid = id
item.uId = Math.random() * 1000
item.valueOver = item.valueOver =
item.integrityData == 3.14159 item.integrityData == 3.14159
? 0 ? 0
@@ -325,11 +330,10 @@ const tree2List = (list: any, pid?: string) => {
: item.integrityData >= 60 && item.integrityData < 90 : item.integrityData >= 60 && item.integrityData < 90
? 2 ? 2
: 3 : 3
item.pid = pid
// 判断item是否存在children // 判断item是否存在children
if (!item.children) return arr.push(item) if (!item.children) return arr.push(item)
// 函数递归对children数组进行tree2List的转换 // 函数递归对children数组进行tree2List的转换
const children = tree2List(item.children, item.id) const children = tree2List(item.children, item.uId)
// 删除item的children属性 // 删除item的children属性
delete item.children delete item.children
// 把item和children数组添加至结果数组 // 把item和children数组添加至结果数组
@@ -340,7 +344,11 @@ const tree2List = (list: any, pid?: string) => {
return arr return arr
} }
onMounted(() => {}) onMounted(() => {})
// 补招
const makeUp = () => {
tableRef.value && tableRef.value.getRef().getCheckboxRecords()
console.log("🚀 ~ makeUp ~ tableRef.value.getRef().getCheckboxRecords():", tableRef.value.getRef().getCheckboxRecords())
}
watch( watch(
() => treeData.value, () => treeData.value,
(val, oldVal) => { (val, oldVal) => {

View File

@@ -74,10 +74,15 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="电网标志"> <el-form-item label="电网标志">
<el-select v-model="tableStore.table.params.powerFlag" placeholder="请选择电网标志"> <el-select v-model="tableStore.table.params.powerFlag" placeholder="请选择电网标志">
<el-option v-for="item in sign" :key="item.id" :label="item.name" :value="item.algoDescribe" /> <el-option
</el-select> v-for="item in sign"
</el-form-item> :key="item.id"
:label="item.name"
:value="item.algoDescribe"
/>
</el-select>
</el-form-item>
</template> </template>
</TableHeader> </TableHeader>
</div> </div>
@@ -86,7 +91,7 @@
<el-tab-pane :name="0" :lazy="true" label="谐波畸变率统计表"> <el-tab-pane :name="0" :lazy="true" label="谐波畸变率统计表">
<Table <Table
ref="tableRef" ref="tableRef"
:tree-config="{ transform: true, parentField: 'pid' }" :tree-config="{ transform: true, parentField: 'uPid', rowField: 'uId' }"
:scroll-y="{ enabled: true }" :scroll-y="{ enabled: true }"
v-if="activeName == 0" v-if="activeName == 0"
/> />
@@ -164,7 +169,7 @@ const tableStore = new TableStore({
title: '电压等级', title: '电压等级',
field: 'voltageLevel', field: 'voltageLevel',
align: 'center', align: 'center',
formatter: function (row) { formatter: function (row) {
return row.cellValue ? row.cellValue : '/' return row.cellValue ? row.cellValue : '/'
} }
}, },
@@ -195,10 +200,8 @@ const tableStore = new TableStore({
], ],
loadCallback: () => { loadCallback: () => {
let treeData = [] tableStore.table.data = tree2List(tableStore.table.data, Math.random() * 1000)
treeData = tree2List(tableStore.table.data)
tableStore.table.column[0].title = tableStore.table.params.statisticalType.name tableStore.table.column[0].title = tableStore.table.params.statisticalType.name
tableStore.table.data = JSON.parse(JSON.stringify(treeData))
chartsRef.value && chartsRef.value.getTableStoreParams(tableStore.table.params) chartsRef.value && chartsRef.value.getTableStoreParams(tableStore.table.params)
setTimeout(() => { setTimeout(() => {
activeName.value == 0 && tableRef.value && tableRef.value.getRef().setAllTreeExpand(true) activeName.value == 0 && tableRef.value && tableRef.value.getRef().setAllTreeExpand(true)
@@ -213,18 +216,18 @@ tableStore.table.params.loadType = []
tableStore.table.params.powerFlag = sign[0]?.algoDescribe || 0 tableStore.table.params.powerFlag = sign[0]?.algoDescribe || 0
tableStore.table.params.serverName = 'harmonicBoot' tableStore.table.params.serverName = 'harmonicBoot'
provide('tableStore', tableStore) provide('tableStore', tableStore)
const tree2List = (list: any, pid?: string) => { const tree2List = (list: any, id?: string) => {
//存储结果的数组 //存储结果的数组
let arr: any = [] let arr: any = []
// 遍历 tree 数组 // 遍历 tree 数组
list.forEach((item: any) => { list.forEach((item: any) => {
// item.comFlag = item.comFlag == null ? 3 : item.comFlag item.uPid = id
item.uId = Math.random() * 1000
item.valueOver == 3.14159 ? 0 : item.valueOver >= 90 ? 1 : item.valueOver && item.valueOver < 90 ? 2 : 3 item.valueOver == 3.14159 ? 0 : item.valueOver >= 90 ? 1 : item.valueOver && item.valueOver < 90 ? 2 : 3
item.pid = pid
// 判断item是否存在children // 判断item是否存在children
if (!item.children) return arr.push(item) if (!item.children) return arr.push(item)
// 函数递归对children数组进行tree2List的转换 // 函数递归对children数组进行tree2List的转换
const children = tree2List(item.children, item.id) const children = tree2List(item.children, item.uId)
// 删除item的children属性 // 删除item的children属性
delete item.children delete item.children
// 把item和children数组添加至结果数组 // 把item和children数组添加至结果数组
@@ -234,6 +237,7 @@ const tree2List = (list: any, pid?: string) => {
// 返回结果数组 // 返回结果数组
return arr return arr
} }
onMounted(() => { onMounted(() => {
tableStore.index() tableStore.index()
}) })

View File

@@ -1,7 +1,7 @@
<template> <template>
<div class="default-main online"> <div class="default-main online">
<div class="online_header"> <div class="online_header">
<TableHeader date-picker ref="tableHeaderRef" > <TableHeader date-picker ref="tableHeaderRef">
<template #select> <template #select>
<el-form-item label="统计类型:"> <el-form-item label="统计类型:">
<el-select <el-select
@@ -110,7 +110,7 @@
<el-tab-pane :name="0" :lazy="true" label="终端在线率列表"> <el-tab-pane :name="0" :lazy="true" label="终端在线率列表">
<Table <Table
ref="tableRef" ref="tableRef"
:tree-config="{ transform: true, parentField: 'pid' }" :tree-config="{ transform: true, parentField: 'uPid', rowField: 'uId' }"
:scroll-y="{ enabled: true }" :scroll-y="{ enabled: true }"
v-if="activeName == 0" v-if="activeName == 0"
/> />
@@ -193,7 +193,7 @@ const tableStore = new TableStore({
field: 'name', field: 'name',
align: 'left', align: 'left',
treeNode: true, treeNode: true,
width: 350, width: 350
}, },
{ {
title: '网络参数', title: '网络参数',
@@ -255,7 +255,7 @@ const tableStore = new TableStore({
title: '评估', title: '评估',
field: 'valueOver', field: 'valueOver',
align: 'center', align: 'center',
effect:"dark", effect: 'dark',
render: 'tag', render: 'tag',
custom: { custom: {
null: 'info', null: 'info',
@@ -289,9 +289,10 @@ const tableStore = new TableStore({
// tableStore.table.params.searchEndTime = tableHeaderRef.value.datePickerRef.timeValue[1] // tableStore.table.params.searchEndTime = tableHeaderRef.value.datePickerRef.timeValue[1]
}, },
loadCallback: () => { loadCallback: () => {
let treeData = [] // let treeData = []
treeData = tree2List(tableStore.table.data) // treeData = tree2List(tableStore.table.data)
tableStore.table.data = JSON.parse(JSON.stringify(treeData)) // tableStore.table.data = JSON.parse(JSON.stringify(treeData))
tableStore.table.data = tree2List(tableStore.table.data, Math.random() * 1000)
chartsRef.value && chartsRef.value.getTableStoreParams(tableStore.table.params) chartsRef.value && chartsRef.value.getTableStoreParams(tableStore.table.params)
setTimeout(() => { setTimeout(() => {
activeName.value == 0 && tableRef.value && tableRef.value.getRef().setAllTreeExpand(true) activeName.value == 0 && tableRef.value && tableRef.value.getRef().setAllTreeExpand(true)
@@ -305,18 +306,18 @@ tableStore.table.params.scale = []
tableStore.table.params.manufacturer = [] tableStore.table.params.manufacturer = []
tableStore.table.params.loadType = [] tableStore.table.params.loadType = []
provide('tableStore', tableStore) provide('tableStore', tableStore)
const tree2List = (list: any, pid?: string) => { const tree2List = (list: any, id?: string) => {
//存储结果的数组 //存储结果的数组
let arr: any = [] let arr: any = []
// 遍历 tree 数组 // 遍历 tree 数组
list.forEach((item: any) => { list.forEach((item: any) => {
// item.comFlag = item.comFlag == null ? 3 : item.comFlag item.uPid = id
item.uId = Math.random() * 1000
item.valueOver == 3.14159 ? 0 : item.valueOver >= 90 ? 1 : item.valueOver && item.valueOver < 90 ? 2 : 3 item.valueOver == 3.14159 ? 0 : item.valueOver >= 90 ? 1 : item.valueOver && item.valueOver < 90 ? 2 : 3
item.pid = pid
// 判断item是否存在children // 判断item是否存在children
if (!item.children) return arr.push(item) if (!item.children) return arr.push(item)
// 函数递归对children数组进行tree2List的转换 // 函数递归对children数组进行tree2List的转换
const children = tree2List(item.children, item.id) const children = tree2List(item.children, item.uId)
// 删除item的children属性 // 删除item的children属性
delete item.children delete item.children
// 把item和children数组添加至结果数组 // 把item和children数组添加至结果数组
@@ -325,6 +326,7 @@ const tree2List = (list: any, pid?: string) => {
}) })
// 返回结果数组 // 返回结果数组
return arr return arr
} }
onMounted(() => {}) onMounted(() => {})
@@ -342,6 +344,4 @@ watch(
} }
) )
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped></style>
</style>

View File

@@ -86,7 +86,7 @@
<el-tab-pane :name="0" :lazy="true" label="稳态合格率统计表"> <el-tab-pane :name="0" :lazy="true" label="稳态合格率统计表">
<Table <Table
ref="tableRef" ref="tableRef"
:tree-config="{ transform: true, parentField: 'pid' }" :tree-config="{ transform: true, parentField: 'uPid', rowField: 'uId' }"
:scroll-y="{ enabled: true }" :scroll-y="{ enabled: true }"
v-if="activeName == 0" v-if="activeName == 0"
/> />
@@ -253,10 +253,9 @@ const tableStore = new TableStore({
], ],
loadCallback: () => { loadCallback: () => {
let treeData = [] tableStore.table.data = tree2List(tableStore.table.data, Math.random() * 1000)
treeData = tree2List(tableStore.table.data)
tableStore.table.column[0].title = tableStore.table.params.statisticalType.name tableStore.table.column[0].title = tableStore.table.params.statisticalType.name
tableStore.table.data = JSON.parse(JSON.stringify(treeData))
chartsRef.value && chartsRef.value.getTableStoreParams(tableStore.table.params) chartsRef.value && chartsRef.value.getTableStoreParams(tableStore.table.params)
setTimeout(() => { setTimeout(() => {
activeName.value == 0 && tableRef.value && tableRef.value.getRef().setAllTreeExpand(true) activeName.value == 0 && tableRef.value && tableRef.value.getRef().setAllTreeExpand(true)
@@ -271,18 +270,39 @@ tableStore.table.params.loadType = []
tableStore.table.params.serverName = 'harmonicBoot' tableStore.table.params.serverName = 'harmonicBoot'
tableStore.table.params.powerFlag = sign[0]?.algoDescribe || 0 tableStore.table.params.powerFlag = sign[0]?.algoDescribe || 0
provide('tableStore', tableStore) provide('tableStore', tableStore)
const tree2List = (list: any, pid?: string) => { // const tree2List = (list: any, pid?: string) => {
// //存储结果的数组
// let arr: any = []
// // 遍历 tree 数组
// list.forEach((item: any) => {
// // item.comFlag = item.comFlag == null ? 3 : item.comFlag
// item.valueOver == 3.14159 ? 0 : item.valueOver >= 90 ? 1 : item.valueOver && item.valueOver < 90 ? 2 : 3
// item.pid = pid
// // 判断item是否存在children
// if (!item.children) return arr.push(item)
// // 函数递归对children数组进行tree2List的转换
// const children = tree2List(item.children, item.id)
// // 删除item的children属性
// delete item.children
// // 把item和children数组添加至结果数组
// //..children: 意思是把children数组展开
// arr.push(item, ...children)
// })
// // 返回结果数组
// return arr
// }
const tree2List = (list: any, id?: string) => {
//存储结果的数组 //存储结果的数组
let arr: any = [] let arr: any = []
// 遍历 tree 数组 // 遍历 tree 数组
list.forEach((item: any) => { list.forEach((item: any) => {
// item.comFlag = item.comFlag == null ? 3 : item.comFlag item.uPid = id
item.uId = Math.random() * 1000
item.valueOver == 3.14159 ? 0 : item.valueOver >= 90 ? 1 : item.valueOver && item.valueOver < 90 ? 2 : 3 item.valueOver == 3.14159 ? 0 : item.valueOver >= 90 ? 1 : item.valueOver && item.valueOver < 90 ? 2 : 3
item.pid = pid
// 判断item是否存在children // 判断item是否存在children
if (!item.children) return arr.push(item) if (!item.children) return arr.push(item)
// 函数递归对children数组进行tree2List的转换 // 函数递归对children数组进行tree2List的转换
const children = tree2List(item.children, item.id) const children = tree2List(item.children, item.uId)
// 删除item的children属性 // 删除item的children属性
delete item.children delete item.children
// 把item和children数组添加至结果数组 // 把item和children数组添加至结果数组
@@ -291,7 +311,7 @@ const tree2List = (list: any, pid?: string) => {
}) })
// 返回结果数组 // 返回结果数组
return arr return arr
} }
onMounted(() => { onMounted(() => {
tableStore.index() tableStore.index()
}) })

View File

@@ -178,7 +178,7 @@
</div> </div>
<Table <Table
ref="tableRef" ref="tableRef"
:tree-config="{ transform: true, parentField: 'pid' }" :tree-config="{ transform: true,parentField: 'uPid', rowField: 'uId' }"
:scroll-y="{ enabled: true }" :scroll-y="{ enabled: true }"
v-if="activeName == 0" v-if="activeName == 0"
/> />
@@ -345,10 +345,9 @@ const tableStore = new TableStore({
// tableStore.table.params.searchEndTime = tableHeaderRef.value.datePickerRef.timeValue[1] // tableStore.table.params.searchEndTime = tableHeaderRef.value.datePickerRef.timeValue[1]
}, },
loadCallback: () => { loadCallback: () => {
let treeData = [] tableStore.table.data = tree2List(tableStore.table.data, Math.random() * 1000)
treeData = tree2List(tableStore.table.data)
tableStore.table.column[0].title = formData.value.statisticalType.name tableStore.table.column[0].title = formData.value.statisticalType.name
tableStore.table.data = JSON.parse(JSON.stringify(treeData))
chartsRef.value&&chartsRef.value.getTableStoreParams(tableStore.table.params) chartsRef.value&&chartsRef.value.getTableStoreParams(tableStore.table.params)
setTimeout(() => { setTimeout(() => {
activeName.value == 0 && tableRef.value && tableRef.value.getRef().setAllTreeExpand(true) activeName.value == 0 && tableRef.value && tableRef.value.getRef().setAllTreeExpand(true)
@@ -365,18 +364,18 @@ tableStore.table.params.scale = []
tableStore.table.params.manufacturer = [] tableStore.table.params.manufacturer = []
tableStore.table.params.loadType = [] tableStore.table.params.loadType = []
provide('tableStore', tableStore) provide('tableStore', tableStore)
const tree2List = (list: any, pid?: string) => { const tree2List = (list: any, id?: string) => {
//存储结果的数组 //存储结果的数组
let arr: any = [] let arr: any = []
// 遍历 tree 数组 // 遍历 tree 数组
list.forEach((item: any) => { list.forEach((item: any) => {
// item.comFlag = item.comFlag == null ? 3 : item.comFlag item.uPid = id
item.uId = Math.random() * 1000
item.valueOver == 3.14159 ? 0 : item.valueOver >= 90 ? 1 : item.valueOver && item.valueOver < 90 ? 2 : 3 item.valueOver == 3.14159 ? 0 : item.valueOver >= 90 ? 1 : item.valueOver && item.valueOver < 90 ? 2 : 3
item.pid = pid
// 判断item是否存在children // 判断item是否存在children
if (!item.children) return arr.push(item) if (!item.children) return arr.push(item)
// 函数递归对children数组进行tree2List的转换 // 函数递归对children数组进行tree2List的转换
const children = tree2List(item.children, item.id) const children = tree2List(item.children, item.uId)
// 删除item的children属性 // 删除item的children属性
delete item.children delete item.children
// 把item和children数组添加至结果数组 // 把item和children数组添加至结果数组
@@ -386,6 +385,7 @@ const tree2List = (list: any, pid?: string) => {
// 返回结果数组 // 返回结果数组
return arr return arr
} }
onMounted(() => {}) onMounted(() => {})
watch( watch(

View File

@@ -209,7 +209,7 @@ const histogram = (res: any) => {
var tips = '' var tips = ''
for (var i = 0; i < params.length; i++) { for (var i = 0; i < params.length; i++) {
tips += params[i].name + '</br/>' tips += params[i].name + '</br/>'
tips += '监测点' + ':' + '&nbsp' + '&nbsp' + (params[i].value == 0.14159 ? '暂无数据' : params[i].value) + '</br/>' tips += '超标监测点占比' + ':' + '&nbsp' + '&nbsp' + (params[i].value == 0.14159 ? '暂无数据' : params[i].value) + '</br/>'
} }
return tips return tips
} }
@@ -220,7 +220,7 @@ const histogram = (res: any) => {
data: res.map((item: any) => item.name) data: res.map((item: any) => item.name)
}, },
yAxis: { yAxis: {
name: '等级',// 给X轴加单位 name: '超标占比',// 给X轴加单位
min: 0, min: 0,
max: 100, max: 100,
@@ -239,7 +239,7 @@ const histogram = (res: any) => {
dataZoom: null, dataZoom: null,
series: [ series: [
{ {
type: 'bar', type: 'bar',
data: res.map((item: any) => { data: res.map((item: any) => {
return item.lineRatio == 3.14159 ? 0.14159 : item.lineRatio return item.lineRatio == 3.14159 ? 0.14159 : item.lineRatio

File diff suppressed because it is too large Load Diff

View File

@@ -225,7 +225,7 @@ const inputQuery: any = ref('')
const QueryList: any = ref([]) const QueryList: any = ref([])
const activeName: any = ref(0) const activeName: any = ref(0)
const zoomMap = ref(8.8) const zoomMap = ref(9.8)
const colorKey = ref('') const colorKey = ref('')
const showCollapse: any = ref(true) const showCollapse: any = ref(true)
const showWrap: any = ref(false) const showWrap: any = ref(false)
@@ -237,30 +237,100 @@ const imgUrl0 = new URL('@/assets/img/BDZ-ZS.png', import.meta.url).href
const imgUrl1 = new URL('@/assets/img/ZD-ZS.png', import.meta.url).href const imgUrl1 = new URL('@/assets/img/ZD-ZS.png', import.meta.url).href
const imgUrl2 = new URL('@/assets/img/JCD-ZS.png', import.meta.url).hre const imgUrl2 = new URL('@/assets/img/JCD-ZS.png', import.meta.url).hre
const boundaryList: any = ref([ const boundaryList: any = ref([
// {
// orgName: '唐山',
// LngLat: [118.335849137, 39.7513593355],
// boundary: mapJson.tsJSON
// },
// {
// orgName: '张家口',
// LngLat: [115.032504679, 40.8951549951],
// boundary: mapJson.zjkJSON
// },
// {
// orgName: '秦皇岛',
// LngLat: [119.185113833, 40.1179119754],
// boundary: mapJson.qhdJSON
// },
// {
// orgName: '承德',
// LngLat: [117.548498365, 41.3775890632],
// boundary: mapJson.cdJSON
// },
// {
// orgName: '廊坊',
// LngLat: [116.628004129, 39.0589378611],
// boundary: mapJson.lfJSON
// }
{ {
orgName: '唐山', orgName: '大连',
LngLat: [118.335849137, 39.7513593355], LngLat: [122.060077, 39.635794],
boundary: mapJson.tsJSON boundary: mapJson['大连']
}, },
{ {
orgName: '张家口', orgName: '抚顺',
LngLat: [115.032504679, 40.8951549951], LngLat: [124.354599, 41.88962],
boundary: mapJson.zjkJSON boundary: mapJson['抚顺']
}, },
{ {
orgName: '秦皇岛', orgName: '沈阳',
LngLat: [119.185113833, 40.1179119754], LngLat: [123.0389, 41.992993],
boundary: mapJson.qhdJSON boundary: mapJson['沈阳']
}, },
{ {
orgName: '承德', orgName: '丹东',
LngLat: [117.548498365, 41.3775890632], LngLat: [124.585661, 40.645967],
boundary: mapJson.cdJSON boundary: mapJson['丹东']
}, },
{ {
orgName: '廊坊', orgName: '营口',
LngLat: [116.628004129, 39.0589378611], LngLat: [122.225226, 40.433551],
boundary: mapJson.lfJSON boundary: mapJson['营口']
},
{
orgName: '盘锦',
LngLat: [121.875362, 41.075416],
boundary: mapJson['盘锦']
},
{
orgName: '铁岭',
LngLat: [124.229492, 42.731873],
boundary: mapJson['铁岭']
},
{
orgName: '朝阳',
LngLat: [121.42, 41.58],
boundary: mapJson['朝阳']
},
{
orgName: '葫芦岛',
LngLat: [119.850873, 40.728517],
boundary: mapJson['葫芦岛']
},
{
orgName: '锦州',
LngLat: [119.140944, 41.39657],
boundary: mapJson['锦州']
},
{
orgName: '阜新',
LngLat: [121.658585, 42.350951],
boundary: mapJson['阜新']
},
{
orgName: '本溪',
LngLat: [124.390785, 41.197021],
boundary: mapJson['本溪']
},
{
orgName: '辽阳',
LngLat: [123.090785, 41.297021],
boundary: mapJson['辽阳']
},
{
orgName: '鞍山',
LngLat: [122.808845, 40.840049],
boundary: mapJson['鞍山']
} }
]) ])
@@ -270,8 +340,8 @@ const siteList = ref<any>([])
const polyline = ref<any>([]) const polyline = ref<any>([])
const lineId = ref('') const lineId = ref('')
const center = ref({ const center = ref({
lng: 116.84428600000001, lng: 122.42588,
lat: 40.57707185292256 lat: 41.210977
}) })
const infoWindowPoint = ref<anyObj>({ const infoWindowPoint = ref<anyObj>({
lng: 0, lng: 0,
@@ -464,6 +534,7 @@ const grids = (row: any) => {
getGridDiagramAreaData({ ...form, deptIndex: deptIndex.value }).then((res: any) => { getGridDiagramAreaData({ ...form, deptIndex: deptIndex.value }).then((res: any) => {
AreaData.value = res.data AreaData.value = res.data
console.log('🚀 ~ getGridDiagramAreaData ~ AreaData.value:', AreaData.value)
GridDiagramArea() GridDiagramArea()
}) })
// if (powerManageGridMap.value) powerLoad() // if (powerManageGridMap.value) powerLoad()

View File

@@ -145,6 +145,7 @@
</span> </span>
</template> </template>
</vxe-column> </vxe-column>
<vxe-column field="manufacturer" title="终端厂家"></vxe-column>
<vxe-column field="devName" title="所属终端名称"> <vxe-column field="devName" title="所属终端名称">
<template #default="{ row }"> <template #default="{ row }">
<span class="table_name"> <span class="table_name">
@@ -152,6 +153,11 @@
</span> </span>
</template> </template>
</vxe-column> </vxe-column>
<vxe-column field="ip" title="IP">
<template #default="{ row }">
{{ decryptFromBase64(row.ip) }}
</template>
</vxe-column>
<vxe-column field="stationName" title="所属电站"> <vxe-column field="stationName" title="所属电站">
<template #default="{ row }"> <template #default="{ row }">
<span class="table_name"> <span class="table_name">
@@ -196,7 +202,7 @@ import MyEchart from '@/components/echarts/MyEchart.vue'
import alarmDetails from './alarmDetails.vue' import alarmDetails from './alarmDetails.vue'
import { getMonitorLimitDataDay } from '@/api/device-boot/dataVerify' import { getMonitorLimitDataDay } from '@/api/device-boot/dataVerify'
import { queryFirstNode } from '@/api/auth' import { queryFirstNode } from '@/api/auth'
import { decryptFromBase64 } from '@/utils/index'
const alarmDetailsRef = ref() const alarmDetailsRef = ref()
const dictData = useDictData() const dictData = useDictData()
//字典获取监督对象类型 //字典获取监督对象类型

View File

@@ -169,6 +169,7 @@
</span> </span>
</template> </template>
</vxe-column> </vxe-column>
<vxe-column field="manufacturer" title="终端厂家"></vxe-column>
<vxe-column field="devName" title="所属终端名称"> <vxe-column field="devName" title="所属终端名称">
<template #default="{ row }"> <template #default="{ row }">
<span class="table_name"> <span class="table_name">
@@ -176,6 +177,11 @@
</span> </span>
</template> </template>
</vxe-column> </vxe-column>
<vxe-column field="ip" title="IP">
<template #default="{ row }">
{{ decryptFromBase64(row.ip) }}
</template>
</vxe-column>
<vxe-column field="stationName" title="所属电站"> <vxe-column field="stationName" title="所属电站">
<template #default="{ row }"> <template #default="{ row }">
<span class="table_name"> <span class="table_name">
@@ -219,6 +225,7 @@ import MyEchart from '@/components/echarts/MyEchart.vue'
import anomalyDetails from './anomalyDetails.vue' import anomalyDetails from './anomalyDetails.vue'
import { getMonitorVerifyDay } from '@/api/device-boot/dataVerify' import { getMonitorVerifyDay } from '@/api/device-boot/dataVerify'
import { queryFirstNode } from '@/api/auth' import { queryFirstNode } from '@/api/auth'
import { decryptFromBase64 } from '@/utils/index'
const anomalyDetailsRef = ref() const anomalyDetailsRef = ref()
const dictData = useDictData() const dictData = useDictData()