CN-906 fix: 知识库列表排序字段名更正

This commit is contained in:
chenjinsong
2023-03-06 14:19:29 +08:00
parent e2f9eb7f59
commit ac28e52ca7
4 changed files with 28 additions and 6 deletions

View File

@@ -126,7 +126,8 @@ export default {
{
label: this.$t('overall.createTime'),
prop: 'ctime',
show: false
show: false,
sortable: 'custom'
},
{
label: this.$t('overall.updatedBy'),
@@ -136,7 +137,8 @@ export default {
{
label: this.$t('overall.updateTime'),
prop: 'utime',
show: false
show: false,
sortable: 'custom'
}
]
}

View File

@@ -55,13 +55,14 @@ export default {
})
},
tableDataSort (item) {
let orderBy = ''
/*let orderBy = ''
if (item.order === 'ascending') {
if (item.prop === 'lastTime') {
orderBy = chartTableOrderOptionsMapping[item.prop]
} else {
orderBy = item.prop
}
orderBy = chartTableOrderOptionsMapping[item.prop] || item.prop
}
if (item.order === 'descending') {
if (item.prop === 'lastTime') {
@@ -69,7 +70,8 @@ export default {
} else {
orderBy = '-' + item.prop
}
}
}*/
const orderBy = (item.order === 'descending' ? '-' : '') + (chartTableOrderOptionsMapping[item.prop] || item.prop)
this.$emit('orderBy', orderBy)
}
}

View File

@@ -122,7 +122,8 @@ export const chartTableColumnMapping = {
ip: 'IP'
}
export const chartTableOrderOptionsMapping = {
lastTime: 'last_time'
lastTime: 'last_time',
tagName: 'tag_name'
}
export const chartPieTableTopOptions = [
{ name: 'Sessions', value: 'sessions' },

View File

@@ -42,7 +42,7 @@ import cnDataList from '@/components/table/CnDataList'
import dataListMixin from '@/mixins/data-list'
import KnowledgeBaseTable from '@/components/table/setting/KnowledgeBaseTable'
import { api } from '@/utils/api'
import { get } from '@/utils/http'
import {del, get} from '@/utils/http'
export default {
name: 'knowledgeBase',
@@ -67,6 +67,23 @@ export default {
}
})
},
del (row) {
this.$confirm(this.$t('tip.confirmDelete'), {
confirmButtonText: this.$t('tip.yes'),
cancelButtonText: this.$t('tip.no'),
type: 'warning'
}).then(() => {
del(this.url + '?ids=' + row.knowledgeId).then(response => {
if (response.code === 200) {
this.delFlag = true
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.deleteSuccess') })
this.getTableData()
} else {
this.$message.error(response.msg)
}
})
})
},
jumpToCreatePage () {
this.$router.push({
path: '/knowledgeBase/form',