Merge pull request 'dj' (#828) from dj into master
Reviewed-on: http://git.feashow.cn/clay/mosr-web/pulls/828
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div style="display: flex;justify-content: center">
|
||||
<span class="stateIcon" :style="{backgroundColor: filterDictClass(cacheStore.getDict(dictType), value)}"></span>
|
||||
<span>{{tag.label}}</span>
|
||||
<span>{{tagConfig.label}}</span>
|
||||
<span> {{ filterDict(cacheStore.getDict(dictType), value) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
@@ -21,37 +21,43 @@ const props = defineProps({
|
||||
default: null
|
||||
}
|
||||
});
|
||||
const tag = reactive({
|
||||
const tagConfig = reactive({
|
||||
listClass: "green",
|
||||
isType: true,
|
||||
label: ""
|
||||
});
|
||||
// const dictList = cacheStore.getDict(props.dictType);
|
||||
// const dictFormat = () => {
|
||||
// if(dictList===undefined) return;
|
||||
// for (let i = 0; i < dictList.length; i++) {
|
||||
// if(dictList[i].value=== props.value){
|
||||
// tag.label = dictList[i].label;
|
||||
// tag.listClass=changeParams(dictList[i].listClass)
|
||||
// tag.isType = dictList[i].isType;
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
const filterDictClass = (data, value) => {
|
||||
if(!data) return
|
||||
|
||||
if(data instanceof Array) {
|
||||
tag.value = data.find(item => item.value == value)
|
||||
const filterDictClass = (data, value) => {
|
||||
if (!data|| value == null) return 'gray'
|
||||
if (data instanceof Array) {
|
||||
tagConfig.value = data.find(item => item.value == value)
|
||||
if (!tagConfig.value) {
|
||||
return '#409EFF'
|
||||
} else {
|
||||
if (tagConfig.value?.isType) {
|
||||
return changeParams(tagConfig.value.listClass)
|
||||
} else {
|
||||
return tagConfig.value.listClass
|
||||
}
|
||||
}
|
||||
}
|
||||
return changeParams(tag.value.listClass)
|
||||
}
|
||||
const filterDict = (data, value) => {
|
||||
if(!data) return
|
||||
|
||||
if(data instanceof Array) {
|
||||
tag.value = data.find(item => item.value == value)
|
||||
if (!data || value == null) return '未知'
|
||||
if (data instanceof Array) {
|
||||
if (value == true || value == false) {
|
||||
tagConfig.value = data.find(item => item.value == value.toString())
|
||||
} else if (typeof value === "object") {
|
||||
if (value !== null) {
|
||||
tagConfig.value = data.find(item => item.value == value[0])
|
||||
} else {
|
||||
tagConfig.value = {}
|
||||
}
|
||||
} else {
|
||||
tagConfig.value = data.find(item => item.value == value)
|
||||
}
|
||||
}
|
||||
return tag.value.label
|
||||
return tagConfig.value?.label || '未知'
|
||||
}
|
||||
/**
|
||||
* 根据接口返回的listClass切换成对应的颜色
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<el-button v-if="tableConfig.export && tableConfig.export.open" @click="exportTable" color="#DED0B2"
|
||||
style="margin-bottom: 10px">导出
|
||||
</el-button>
|
||||
<!-- 列显示配置 -->
|
||||
<div v-if="isSettingCol" style="float: right">
|
||||
<el-button v-if="tableConfig.export && tableConfig.export.open" @click="exportTable" color="#DED0B2"
|
||||
style="margin-bottom: 10px">导出
|
||||
</el-button>
|
||||
<el-tooltip effect="dark" content="列配置" placement="bottom">
|
||||
<el-button ref="buttonRef" link>
|
||||
<el-icon size="18">
|
||||
|
||||
Reference in New Issue
Block a user