fix NEZ-3432 : chart-table 默认排序选中后 无法取消 以及 数字排序错误的问题

This commit is contained in:
zhangyu
2024-04-01 16:53:53 +08:00
parent e17027390e
commit 4d5ff70dd0
10 changed files with 16 additions and 17 deletions

View File

@@ -237,6 +237,7 @@ export default {
this.seriesItem = this.filterShowData(this.storedTableData, this.pageObj, 'series')
},
filterShowData (source, pageObj, from) {
console.log(123123123)
let orderBy = null
let sourceData = null
if (from === 'series') {
@@ -251,10 +252,12 @@ export default {
source = Object.assign([], sourceData)
} else { // 排序之后的顺序
if (orderBy.order === 'ascending') {
source = source.sort(this.$tableSet.asce(orderBy.prop))
console.log(source)
source = source.sort(this.$tableSet.asce(orderBy.prop, true))
}
if (orderBy.order === 'descending') {
source = source.sort(this.$tableSet.desc(orderBy.prop))
console.log(source)
source = source.sort(this.$tableSet.desc(orderBy.prop, true))
}
}
return source.slice((pageObj.pageNo - 1) * pageObj.pageSize, pageObj.pageNo * pageObj.pageSize)
@@ -604,6 +607,7 @@ export default {
},
// 数据排序
tableDataSort (item) {
console.log(item)
this.orderBy = { order: item.order, prop: item.prop }
this.seriesItem = this.filterShowData(this.storedTableData, this.pageObj, 'series')
},

View File

@@ -300,7 +300,6 @@ export default {
oldValue: ''
}
const display = this.globalVariablesReplace(column.display)
console.log(column, display, /\{\{.+\}\}/.test(display), params)
if (/\{\{.+\}\}/.test(display)) {
const labelValue = display.replace(/(\{\{.+?\}\})/g, function (i) {
const label = i.substr(i.indexOf('{{') + 2, i.indexOf('}}') - i.indexOf('{{') - 2)
@@ -310,7 +309,6 @@ export default {
if (label.indexOf('$value') !== -1) {
value = chartDataFormat.getUnit(column.unit ? column.unit : 2).compute(value, null, -1, 2)
}
console.log(value)
if (!((typeof value) == 'string' && value.constructor == String) && isNaN(value)) {
let legend = ''
if (value.__name__) {
@@ -360,7 +358,6 @@ export default {
}
return value || ''
})
console.log(labelValue)
obj[column.title + 'display'] = {
display: labelValue,
oldValue: oldLabelValue
@@ -444,8 +441,8 @@ export default {
// 本地正序
asce (prop) {
return function (obj1, obj2) {
let val1 = obj1.display[prop + 'display'].display.replace(/\s*/g, '')
let val2 = obj2.display[prop + 'display'].display.replace(/\s*/g, '')
let val1 = obj1.display[prop + 'display'].oldValue.replace(/\s*/g, '')
let val2 = obj2.display[prop + 'display'].oldValue.replace(/\s*/g, '')
if (!isNaN(val1) && !isNaN(val2)) {
val1 = Number(val1)
val2 = Number(val2)
@@ -462,8 +459,8 @@ export default {
// 本地倒序
desc (prop) {
return function (obj1, obj2) {
let val1 = obj1.display[prop + 'display'].display.replace(/\s*/g, '')
let val2 = obj2.display[prop + 'display'].display.replace(/\s*/g, '')
let val1 = obj1.display[prop + 'display'].oldValue.replace(/\s*/g, '')
let val2 = obj2.display[prop + 'display'].oldValue.replace(/\s*/g, '')
if (!isNaN(val1) && !isNaN(val2)) {
val1 = Number(val1)
val2 = Number(val2)

View File

@@ -11,7 +11,7 @@
:col-num="12"
:is-draggable="!panelLock"
:is-resizable="!panelLock"
:layout.sync="copyDataList"git config global credential.helper store
:layout.sync="copyDataList"
:margin="isGroup ? [10, 10] : [10, 10]"
:row-height="stepWidth"
:vertical-compact="true"

View File

@@ -559,7 +559,6 @@ export default {
routePathParams.body.startAt = this.searchTimeHeader[0] ? this.momentStrToTimestamp(this.searchTimeHeader[0]) : ''
routePathParams.body.endAt = this.searchTimeHeader[1] ? this.momentStrToTimestamp(this.searchTimeHeader[1]) : ''
routePathParams.body.timeType = this.searchTimeHeader[2]
console.log(this.$route, this.$router)
if (!this.searchTimeHeader[2]) {
routePathParams.body.startAt = this.searchTimeHeader[0] ? this.momentStrToTimestamp(this.searchTimeHeader[0]) : ''
routePathParams.body.endAt = this.searchTimeHeader[1] ? this.momentStrToTimestamp(this.searchTimeHeader[1]) : ''

View File

@@ -848,11 +848,11 @@ export const tableSet = {
}
},
// 本地正序
asce (prop) {
asce (prop, useOldValue) {
return function (obj1, obj2) {
let val1 = obj1[prop]
let val2 = obj2[prop]
if (prop === 'value') {
if (prop === 'value' || useOldValue) {
val1 = obj1.oldValue
val2 = obj2.oldValue
}

View File

@@ -837,6 +837,7 @@
:placeholder="$t('overall.auto')"
popper-class="right-box-select-top prevent-clickoutside"
size="small"
clearable
@change="change"
>
<el-option
@@ -860,6 +861,7 @@
:placeholder="$t('overall.auto')"
popper-class="right-box-select-top prevent-clickoutside"
size="small"
clearable
@change="change"
>
<el-option :label="$t('dashboard.dashboard.chartForm.asc')" value="asc"></el-option>

View File

@@ -259,7 +259,6 @@ export default {
return function (record) {
// 当 state = active | silence 时duration = 当前服务器时间result.time- startAt
if (record.state == 1 || record.state == 2) {
console.log(record.startAt, this.nowTime, record.endAt)
return calcDurationByStringTimeB(record.startAt, this.nowTime)
}
if (record.endAt) {

View File

@@ -237,7 +237,6 @@ export default {
this.getUtcStr()
this.getRangeHistoryArr()
const timeTemp = this.$lodash.cloneDeep(this.searchTime)
console.log(this.searchTime)
this.oldSearchTime[0] = timeTemp[0] || ''
this.oldSearchTime[1] = timeTemp[1] || ''
// 监听dateFormat变化 改变日期格式

View File

@@ -200,7 +200,6 @@ export default {
const audio = new Audio('/static/audio/new_alert_message.mp3')
audio.muted = true
audio.play().then(() => {
console.log('autoplay')
this.operationTutorial = false
}).catch((err) => {
console.log(err)

View File

@@ -1 +1 @@
{"baseUrl":"http://192.168.44.22/", "version": "23.06"}
{"baseUrl":"http://192.168.44.100/", "version": "23.06"}