|
@@ -3,29 +3,29 @@
|
|
|
<el-card shadow="never">
|
|
|
<el-form :model="param" inline ref="queryRef" @keyup.enter="getData">
|
|
|
<el-form-item label="" prop="name">
|
|
|
- <el-input v-model="param.name" placeholder="搜索标签名称或英文标识" style="width: 250px" clearable />
|
|
|
+ <el-input v-model="param.name" :placeholder="$t('message.dateCenter.tags.placeholders.searchNameOrCode')" style="width: 250px" clearable />
|
|
|
<el-button type="primary" class="ml10" @click="getData">
|
|
|
<el-icon>
|
|
|
<ele-Search />
|
|
|
</el-icon>
|
|
|
- 查询
|
|
|
+ {{ $t("message.dateCenter.tags.actions.search") }}
|
|
|
</el-button>
|
|
|
<el-button type="primary" class="ml10" @click="addOrEdit()" v-auth="'add'">
|
|
|
<el-icon>
|
|
|
<ele-FolderAdd />
|
|
|
</el-icon>
|
|
|
- 新增标签
|
|
|
+ {{ $t("message.dateCenter.tags.actions.createTag") }}
|
|
|
</el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<el-table :data="tableData" style="width: 100%" row-key="id" default-expand-all :tree-props="{ children: 'children', hasChildren: 'hasChildren' }" v-loading="loading">
|
|
|
- <el-table-column prop="name" v-col="'name'" label="标签名称" min-width="180" show-overflow-tooltip> </el-table-column>
|
|
|
- <el-table-column prop="code" v-col="'code'" label="英文标识" align="center" width="120">
|
|
|
+ <el-table-column prop="name" v-col="'name'" :label="$t('message.dateCenter.tags.columns.name')" min-width="180" show-overflow-tooltip> </el-table-column>
|
|
|
+ <el-table-column prop="code" v-col="'code'" :label="$t('message.dateCenter.tags.columns.code')" align="center" width="120">
|
|
|
<template #default="scope">
|
|
|
<el-tag type="primary" size="small">{{ scope.row.code }}</el-tag>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="color" v-col="'color'" label="颜色" align="center" width="120">
|
|
|
+ <el-table-column prop="color" v-col="'color'" :label="$t('message.dateCenter.tags.columns.color')" align="center" width="120">
|
|
|
<template #default="scope">
|
|
|
<div class="flex" style="justify-content: center">
|
|
|
<div class="color" :style="{ backgroundColor: colorMap.get(scope.row.color)?.color }"></div>
|
|
@@ -33,13 +33,13 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="description" v-col="'description'" label="描述" align="center" show-overflow-tooltip min-width="180"></el-table-column>
|
|
|
- <el-table-column prop="createdAt" v-col="'createdAt'" label="创建时间" align="center" width="180"></el-table-column>
|
|
|
- <el-table-column le-column label="操作" align="center" width="140" v-col="'handle'">
|
|
|
+ <el-table-column prop="description" v-col="'description'" :label="$t('message.dateCenter.tags.columns.description')" align="center" show-overflow-tooltip min-width="180"></el-table-column>
|
|
|
+ <el-table-column prop="createdAt" v-col="'createdAt'" :label="$t('message.dateCenter.tags.columns.createdAt')" align="center" width="180"></el-table-column>
|
|
|
+ <el-table-column le-column :label="$t('message.dateCenter.tags.columns.action')" align="center" width="140" v-col="'handle'">
|
|
|
<template #default="scope">
|
|
|
<template v-if="scope.row.name !== '硬件设施'">
|
|
|
- <el-button size="small" text type="warning" @click="addOrEdit(scope.row)" v-auth="'edit'">修改</el-button>
|
|
|
- <el-button size="small" text type="info" @click="onTabelRowDel(scope.row)" v-auth="'del'">删除</el-button>
|
|
|
+ <el-button size="small" text type="warning" @click="addOrEdit(scope.row)" v-auth="'edit'">{{ $t("message.dateCenter.tags.actions.edit") }}</el-button>
|
|
|
+ <el-button size="small" text type="info" @click="onTabelRowDel(scope.row)" v-auth="'del'">{{ $t("message.dateCenter.tags.actions.delete") }}</el-button>
|
|
|
</template>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -50,27 +50,33 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { ref, reactive, onMounted } from "vue";
|
|
|
+import { ref, reactive, onMounted, computed } from "vue";
|
|
|
import { ElMessageBox, ElMessage } from "element-plus";
|
|
|
import EditDept from "./component/edit.vue";
|
|
|
import api from "/@/api/datahub";
|
|
|
+import { useI18n } from "vue-i18n";
|
|
|
|
|
|
-const colorList = ref([
|
|
|
- { value: "red", label: "红色", color: "#FF0000" },
|
|
|
- { value: "green", label: "绿色", color: "#00FF00" },
|
|
|
- { value: "blue", label: "蓝色", color: "#0000FF" },
|
|
|
- { value: "yellow", label: "黄色", color: "#E8A92A" },
|
|
|
- { value: "purple", label: "紫色", color: "#9A4FF0" },
|
|
|
- { value: "pink", label: "粉色", color: "#E7408C" },
|
|
|
- { value: "indigo", label: "靛蓝", color: "#525EE9" },
|
|
|
- { value: "gray", label: "灰色", color: "#606774" },
|
|
|
- { value: "orange", label: "橙色", color: "#F86724" },
|
|
|
- { value: "cyan", label: "青色", color: "#00C853" },
|
|
|
-]);
|
|
|
+const { t } = useI18n();
|
|
|
|
|
|
-const colorMap = new Map();
|
|
|
-colorList.value.forEach((item) => {
|
|
|
- colorMap.set(item.value, item);
|
|
|
+const colorList = computed(() => {
|
|
|
+ return [
|
|
|
+ { value: "red", label: t("message.dateCenter.tags.options.colors.red"), color: "#FF0000" },
|
|
|
+ { value: "green", label: t("message.dateCenter.tags.options.colors.green"), color: "#00FF00" },
|
|
|
+ { value: "blue", label: t("message.dateCenter.tags.options.colors.blue"), color: "#0000FF" },
|
|
|
+ { value: "yellow", label: t("message.dateCenter.tags.options.colors.yellow"), color: "#E8A92A" },
|
|
|
+ { value: "purple", label: t("message.dateCenter.tags.options.colors.purple"), color: "#9A4FF0" },
|
|
|
+ { value: "pink", label: t("message.dateCenter.tags.options.colors.pink"), color: "#E7408C" },
|
|
|
+ { value: "indigo", label: t("message.dateCenter.tags.options.colors.indigo"), color: "#525EE9" },
|
|
|
+ { value: "gray", label: t("message.dateCenter.tags.options.colors.gray"), color: "#606774" },
|
|
|
+ { value: "orange", label: t("message.dateCenter.tags.options.colors.orange"), color: "#F86724" },
|
|
|
+ { value: "cyan", label: t("message.dateCenter.tags.options.colors.cyan"), color: "#00C853" },
|
|
|
+ ];
|
|
|
+});
|
|
|
+
|
|
|
+const colorMap = computed(() => {
|
|
|
+ const m = new Map<string, { value: string; label: string; color: string }>();
|
|
|
+ colorList.value.forEach((item) => m.set(item.value, item));
|
|
|
+ return m;
|
|
|
});
|
|
|
|
|
|
const editDeptRef = ref();
|
|
@@ -96,13 +102,13 @@ const addOrEdit = (row?: any) => {
|
|
|
};
|
|
|
// 删除当前行
|
|
|
const onTabelRowDel = (row: any) => {
|
|
|
- ElMessageBox.confirm(`此操作将永久删除标签:${row.name}, 是否继续?`, "提示", {
|
|
|
- confirmButtonText: "删除",
|
|
|
- cancelButtonText: "取消",
|
|
|
+ ElMessageBox.confirm(t("message.dateCenter.tags.messages.deleteRowConfirm", { name: row.name }), t("message.dateCenter.tags.messages.tip"), {
|
|
|
+ confirmButtonText: t("message.dateCenter.tags.actions.confirm"),
|
|
|
+ cancelButtonText: t("message.dateCenter.tags.actions.cancel"),
|
|
|
type: "warning",
|
|
|
}).then(() => {
|
|
|
api.tags.del(row.id).then(() => {
|
|
|
- ElMessage.success("删除成功");
|
|
|
+ ElMessage.success(t("message.dateCenter.tags.messages.deleteSuccess"));
|
|
|
getData();
|
|
|
});
|
|
|
});
|