2024-11-15 18:45:58 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<el-table
|
|
|
|
|
|
id="userTable"
|
|
|
|
|
|
ref="dataTable"
|
|
|
|
|
|
:data="tableData"
|
|
|
|
|
|
tooltip-effect="light"
|
|
|
|
|
|
empty-text=" "
|
|
|
|
|
|
@header-dragend="dragend"
|
|
|
|
|
|
@sort-change="tableDataSort"
|
|
|
|
|
|
@selection-change="selectionChange"
|
|
|
|
|
|
>
|
|
|
|
|
|
<el-table-column
|
|
|
|
|
|
:resizable="false"
|
|
|
|
|
|
align="center"
|
|
|
|
|
|
type="selection"
|
|
|
|
|
|
:selectable="checkSelectable"
|
|
|
|
|
|
width="55">
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column
|
|
|
|
|
|
v-for="(item, index) in customTableTitles"
|
|
|
|
|
|
:key="item.prop+index"
|
|
|
|
|
|
:fixed="item.fixed"
|
|
|
|
|
|
:label="item.label"
|
|
|
|
|
|
:min-width="`${item.minWidth}`"
|
|
|
|
|
|
:prop="item.prop"
|
|
|
|
|
|
:resizable="true"
|
|
|
|
|
|
:sort-orders="['ascending', 'descending']"
|
|
|
|
|
|
:sortable="item.sortable"
|
|
|
|
|
|
:width="`${item.width}`"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template #header>
|
|
|
|
|
|
<span class="data-column__span">{{ item.label }}</span>
|
|
|
|
|
|
<div class="col-resize-area"></div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template #default="scope" :column="item">
|
2024-11-19 10:03:59 +08:00
|
|
|
|
<template v-if="item.prop === 'ctime' || item.prop === 'utime'">
|
2024-11-15 18:45:58 +08:00
|
|
|
|
<template v-if="scope.row[item.prop]">
|
|
|
|
|
|
{{ dateFormatByAppearance(scope.row[item.prop]) || '-' }}
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else><span>-</span></template>
|
|
|
|
|
|
</template>
|
2024-11-18 19:44:46 +08:00
|
|
|
|
<template v-if="item.prop === 'entitySource'">
|
|
|
|
|
|
{{ scope.row[item.prop].name || '-' }}
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-if="item.prop === 'entities' || item.prop === 'relations'">
|
|
|
|
|
|
{{ handleListTypes(scope.row[item.prop]) }}
|
|
|
|
|
|
</template>
|
2024-11-15 18:45:58 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<template v-slot:empty>
|
|
|
|
|
|
<div class="table-no-data" v-if="isNoData">
|
|
|
|
|
|
<div class="table-no-data__title">{{ $t('npm.noData') }}</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import table from '@/mixins/table'
|
|
|
|
|
|
import { dateFormatByAppearance } from '@/utils/date-util'
|
|
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
|
name: 'SourcesTable',
|
|
|
|
|
|
props: {
|
|
|
|
|
|
isNoData: {
|
|
|
|
|
|
type: Boolean,
|
|
|
|
|
|
default: false
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
mixins: [table],
|
|
|
|
|
|
data () {
|
|
|
|
|
|
return {
|
|
|
|
|
|
tableTitle: [ // 原始table列
|
|
|
|
|
|
{
|
|
|
|
|
|
label: 'ID',
|
|
|
|
|
|
prop: 'id',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
minWidth: 50,
|
|
|
|
|
|
sortable: 'custom'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
label: this.$t('setting.source'),
|
2024-11-18 19:44:46 +08:00
|
|
|
|
prop: 'entitySource',
|
2024-11-15 18:45:58 +08:00
|
|
|
|
show: true,
|
|
|
|
|
|
sortable: 'custom',
|
2024-11-19 10:03:59 +08:00
|
|
|
|
minWidth: 100
|
2024-11-15 18:45:58 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
label: this.$t('setting.entityTypes'),
|
2024-11-18 19:44:46 +08:00
|
|
|
|
prop: 'entities',
|
2024-11-15 18:45:58 +08:00
|
|
|
|
show: true,
|
2024-11-19 10:03:59 +08:00
|
|
|
|
minWidth: 150
|
2024-11-15 18:45:58 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
label: this.$t('setting.relationTypes'),
|
2024-11-18 19:44:46 +08:00
|
|
|
|
prop: 'relations',
|
2024-11-15 18:45:58 +08:00
|
|
|
|
show: true,
|
|
|
|
|
|
minWidth: 200
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
label: this.$t('config.user.createTime'),
|
2024-11-19 10:03:59 +08:00
|
|
|
|
prop: 'ctime',
|
2024-11-15 18:45:58 +08:00
|
|
|
|
show: true,
|
2024-11-19 10:03:59 +08:00
|
|
|
|
minWidth: 150
|
2024-11-15 18:45:58 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
label: this.$t('overall.updateTime'),
|
2024-11-19 10:03:59 +08:00
|
|
|
|
prop: 'utime',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
minWidth: 150
|
2024-11-15 18:45:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
dateFormatByAppearance,
|
|
|
|
|
|
// 禁止勾选buildIn为1的项,即禁止修改、删除admin的账号
|
|
|
|
|
|
checkSelectable (row) {
|
|
|
|
|
|
return row.buildIn !== 1
|
2024-11-18 19:44:46 +08:00
|
|
|
|
},
|
|
|
|
|
|
handleListTypes (data) {
|
|
|
|
|
|
let str = ''
|
|
|
|
|
|
if (data && typeof data === 'string') {
|
|
|
|
|
|
data = JSON.parse(data)
|
|
|
|
|
|
data.forEach(item => {
|
|
|
|
|
|
if (!str) {
|
|
|
|
|
|
str = item.type + ','
|
|
|
|
|
|
} else if (str.indexOf(item.type) < 0) {
|
|
|
|
|
|
str += item.type + ','
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
str = str.slice(0, -1)
|
|
|
|
|
|
}
|
|
|
|
|
|
return str
|
2024-11-15 18:45:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|