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

View File

@ -73,7 +73,25 @@ export default defineComponent({
maxExportLimit: props.maxExportLimit,
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) => {
console.error(err);
return null;

View File

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