|
|
@@ -7,7 +7,7 @@
|
|
|
|
|
|
import { useCountryInfoStore } from '/@/stores/countryInfo';
|
|
|
import { getTagType } from '/@/utils/useTagColor';
|
|
|
-import { Operation } from '@element-plus/icons-vue';
|
|
|
+import { Operation, Key } from '@element-plus/icons-vue';
|
|
|
import PermissionButton from '/@/components/PermissionButton/index.vue';
|
|
|
|
|
|
|
|
|
@@ -21,13 +21,24 @@ const countryInfoStore = useCountryInfoStore();
|
|
|
const country = countryInfoStore.Countries.find(c => c.code == row.country_code);
|
|
|
const color = country ? country.color : '#3875F6';
|
|
|
const region = countryInfoStore.Region.find(r => r.code == row.region);
|
|
|
-const status = row.status === "open" ? "正常" : "关闭";
|
|
|
|
|
|
-const emit = defineEmits([ 'edit-row']);
|
|
|
+type StatusTagType = '' | 'success' | 'info' | 'warning' | 'danger';
|
|
|
+const statusMap: Record<string, { text: string; type: StatusTagType }> = {
|
|
|
+ open: { text: '正常', type: '' },
|
|
|
+ closed: { text: '关闭', type: 'danger' },
|
|
|
+ Unauthorized: { text: '授权失效', type: 'warning' },
|
|
|
+};
|
|
|
+const statusInfo = statusMap[row.status] ?? { text: row.status ?? '-', type: '' as StatusTagType };
|
|
|
+
|
|
|
+const emit = defineEmits(['edit-row', 'reauthorize']);
|
|
|
|
|
|
function handleEdit() {
|
|
|
emit('edit-row', row);
|
|
|
}
|
|
|
+
|
|
|
+function handleReauthorize() {
|
|
|
+ emit('reauthorize', row);
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
@@ -43,15 +54,12 @@ function handleEdit() {
|
|
|
</el-tag>
|
|
|
</div>
|
|
|
<div v-else-if="field === 'status'">
|
|
|
- <el-tag v-if="row.status === 'open'" :disable-transitions="true" effect="plain" round>
|
|
|
- {{status }}
|
|
|
- </el-tag>
|
|
|
- <el-tag v-else :disable-transitions="true" type="danger" effect="plain" round>
|
|
|
- {{status }}
|
|
|
+ <el-tag :disable-transitions="true" :type="statusInfo.type" effect="plain" round>
|
|
|
+ {{ statusInfo.text }}
|
|
|
</el-tag>
|
|
|
</div>
|
|
|
- <div v-else-if="field === 'operate'">
|
|
|
- <el-tooltip :enterable="false" :show-arrow="false" content="评论详情" hide-after="0"
|
|
|
+ <div v-else-if="field === 'operate'" class="flex justify-center gap-2">
|
|
|
+ <el-tooltip :enterable="false" :show-arrow="false" content="编辑" hide-after="0"
|
|
|
placement="top" popper-class="custom-btn-tooltip">
|
|
|
<PermissionButton circle plain type="warning" @click="handleEdit">
|
|
|
<el-icon>
|
|
|
@@ -59,6 +67,14 @@ function handleEdit() {
|
|
|
</el-icon>
|
|
|
</PermissionButton>
|
|
|
</el-tooltip>
|
|
|
+ <el-tooltip v-if="row.status === 'Unauthorized'" :enterable="false" :show-arrow="false" content="重新授权" hide-after="0"
|
|
|
+ placement="top" popper-class="custom-btn-tooltip">
|
|
|
+ <PermissionButton circle plain type="primary" @click="handleReauthorize">
|
|
|
+ <el-icon>
|
|
|
+ <Key />
|
|
|
+ </el-icon>
|
|
|
+ </PermissionButton>
|
|
|
+ </el-tooltip>
|
|
|
</div>
|
|
|
<!-- 动态获取 -->
|
|
|
<div v-else>
|