feat: 统一状态显示

pull/62/head
zhengkunwang223 2022-12-04 18:17:36 +08:00 committed by zhengkunwang223
parent 26039cc19d
commit 880ac3ec55
4 changed files with 47 additions and 2 deletions

View File

@ -17,7 +17,9 @@
<el-col :lg="4" :xl="2">
<div>
{{ $t('commons.table.status') }}:
<el-tag type="success">{{ data.status }}</el-tag>
<el-tag type="info">
<Status :status="data.status"></Status>
</el-tag>
</div>
</el-col>
<el-col :lg="8" :xl="4">
@ -50,6 +52,7 @@ import i18n from '@/lang';
import router from '@/routers';
import { ElMessage, ElMessageBox } from 'element-plus';
import { onMounted, reactive, ref } from 'vue';
import Status from '@/components/status/index.vue';
const props = defineProps({
appKey: {

View File

@ -0,0 +1,32 @@
<template>
<span :style="{ color: getColor(status) }">
{{ $t('commons.status.' + status) }}
</span>
</template>
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
const props = defineProps({
status: {
type: String,
default: 'runnning',
},
});
let status = ref('');
const getColor = (status: string) => {
switch (status) {
case 'running':
return '#00c957';
case 'error':
return '#ff0000';
default:
return '';
}
};
onMounted(() => {
status.value = props.status.toLocaleLowerCase();
});
</script>

View File

@ -128,6 +128,11 @@ export default {
changePassword: '',
logout: '退',
},
status: {
running: '',
stopped: '',
error: '',
},
},
menu: {
home: '',

View File

@ -27,7 +27,11 @@
{{ $t('website.' + row.type) }}
</template>
</el-table-column>
<el-table-column :label="$t('commons.table.status')" prop="status"></el-table-column>
<el-table-column :label="$t('commons.table.status')" prop="status">
<template #default="{ row }">
<Status :status="row.status"></Status>
</template>
</el-table-column>
<el-table-column :label="$t('website.remark')" prop="remark"></el-table-column>
<el-table-column :label="$t('website.protocol')" prop="protocol"></el-table-column>
<el-table-column :label="$t('website.expireDate')">
@ -74,6 +78,7 @@ import { WebSite } from '@/api/interface/website';
import AppStatus from '@/components/app-status/index.vue';
import NginxConfig from './nginx/index.vue';
import { dateFromat } from '@/utils/util';
import Status from '@/components/status/index.vue';
import i18n from '@/lang';
import router from '@/routers';