fix: 修复数据库没表情况下报错

This commit is contained in:
meilin.huang
2022-03-24 17:50:44 +08:00
parent 60775bb6e3
commit a475818967
5 changed files with 59 additions and 14 deletions

View File

@@ -12,8 +12,8 @@
"countup.js": "^2.0.7",
"cropperjs": "^1.5.11",
"echarts": "^5.1.1",
"element-plus": "^2.1.3",
"@element-plus/icons-vue": "^1.1.1",
"element-plus": "^2.1.4",
"@element-plus/icons-vue": "^1.1.3",
"jsonlint": "^1.6.3",
"lodash": "^4.17.21",
"mitt": "^3.0.0",

View File

@@ -950,10 +950,5 @@ export default defineComponent({
#data-exec {
min-height: calc(100vh - 155px);
.el-table__empty-text {
width: 100%;
margin-left: 50px;
}
}
</style>

View File

@@ -48,7 +48,11 @@
<el-table v-loading="loading" :data="keys" stripe :highlight-current-row="true" style="cursor: pointer">
<el-table-column show-overflow-tooltip prop="key" label="key"></el-table-column>
<el-table-column prop="type" label="type" width="80"> </el-table-column>
<el-table-column prop="type" label="type" width="80">
<template #default="scope">
<el-tag :color="getTypeColor(scope.row.type)" size="small">{{ scope.row.type }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="ttl" label="ttl(过期时间)" width="130">
<template #default="scope">
{{ ttlConveter(scope.row.ttl) }}
@@ -313,6 +317,18 @@ export default defineComponent({
return result;
};
const getTypeColor = (type: string) => {
if (type == 'string') {
return '#E4F5EB';
}
if (type == 'hash') {
return '#F9E2AE';
}
if (type == 'set') {
return '#A8DEE0';
}
};
const onAddData = () => {
notNull(state.scanParam.id, '请先选择redis');
state.dataEdit.operationType = 1;
@@ -338,6 +354,7 @@ export default defineComponent({
getValue,
del,
ttlConveter,
getTypeColor,
onAddData,
onCancelDataEdit,
};