导出模块 添加 dict 处理

This commit is contained in:
icssoa 2021-07-15 18:20:10 +08:00
parent 0219448272
commit 534d03d9a6
3 changed files with 34 additions and 17 deletions

View File

@ -3,7 +3,7 @@
<el-image :src="src" alt=""> <el-image :src="src" alt="">
<template #error> <template #error>
<div class="image-slot"> <div class="image-slot">
<i class="el-icon-picture-outline"></i> <i class="el-icon-user-solid" :style="{ color }"></i>
</div> </div>
</template> </template>
</el-image> </el-image>
@ -20,12 +20,20 @@ export default defineComponent({
props: { props: {
src: String, src: String,
size: { size: {
type: String, type: [String, Number],
default: "large" default: 36
}, },
shape: { shape: {
type: String, type: String,
default: "circle" default: "circle"
},
backgroundColor: {
type: String,
default: "#f7f7f7"
},
color: {
type: String,
default: "#ccc"
} }
}, },
@ -35,7 +43,8 @@ export default defineComponent({
const style = computed(() => { const style = computed(() => {
return { return {
height: size, height: size,
width: size width: size,
backgroundColor: props.backgroundColor
}; };
}); });
@ -49,7 +58,6 @@ export default defineComponent({
<style lang="scss" scoped> <style lang="scss" scoped>
.cl-avatar { .cl-avatar {
overflow: hidden; overflow: hidden;
background-color: #f7f7f7;
&.large { &.large {
height: 50px; height: 50px;
@ -95,9 +103,5 @@ export default defineComponent({
} }
} }
} }
.el-icon-picture-outline {
color: #ccc;
}
} }
</style> </style>

View File

@ -73,7 +73,25 @@ export default defineComponent({
maxExportLimit: props.maxExportLimit, maxExportLimit: props.maxExportLimit,
isExport: true isExport: true
}) })
.then((res: any) => res.list) .then((res: any) => {
return res.list.map((e: any) => {
for (const i in e) {
const col: any = props.columns.find((c: any) => c.prop == i);
if (col) {
if (col.dict) {
const d = col.dict.find((d: any) => d.value == e[i]);
if (d) {
e[i] = d.label;
}
}
}
}
return e;
});
})
.catch((err: string) => { .catch((err: string) => {
console.error(err); console.error(err);
return null; return null;

View File

@ -87,13 +87,8 @@ function useRouter() {
if (!lock) { if (!lock) {
lock = true; lock = true;
if (err.code == "MODULE_NOT_FOUND") { ElMessage.error(`页面不存在或者未配置`);
console.error(err.ElMessage.replace("Cannot find module ", ""), "路由组件不存在"); console.error(err);
ElMessage.error(`路由组件路径错误`);
} else {
console.error(err);
}
setTimeout(() => { setTimeout(() => {
lock = false; lock = false;