-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1.新增 <dict-tag> 自定义组件,用于回显字典标签 2.重构 useDict 方法,支持查询字典数据 3.优化部分字典相关数据类型
- Loading branch information
Showing
30 changed files
with
224 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
continew-admin-system/src/main/resources/mapper/DictItemMapper.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http:https://mybatis.org/dtd/mybatis-3-mapper.dtd" > | ||
<mapper namespace="top.charles7c.cnadmin.system.mapper.DictItemMapper"> | ||
<select id="listByDictCode" resultType="top.charles7c.cnadmin.common.model.vo.LabelValueVO"> | ||
SELECT t1.`label`, t1.`value`, t1.`color` | ||
FROM `sys_dict_item` AS t1 | ||
LEFT JOIN `sys_dict` AS t2 ON t1.`dict_id` = t2.`id` | ||
WHERE t2.`code` = #{dictCode} | ||
ORDER BY t1.`sort` ASC | ||
</select> | ||
</mapper> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<template> | ||
<span v-if="!dictItem"></span> | ||
<span v-else-if="!dictItem.color">{{ dictItem.label }}</span> | ||
<a-tag v-else-if="dictItem.color === 'primary'" color="arcoblue">{{ | ||
dictItem.label | ||
}}</a-tag> | ||
<a-tag v-else-if="dictItem.color === 'success'" color="green">{{ | ||
dictItem.label | ||
}}</a-tag> | ||
<a-tag v-else-if="dictItem.color === 'warning'" color="orangered">{{ | ||
dictItem.label | ||
}}</a-tag> | ||
<a-tag v-else-if="dictItem.color === 'error'" color="red">{{ | ||
dictItem.label | ||
}}</a-tag> | ||
<a-tag v-else-if="dictItem.color === 'default'" color="gray">{{ | ||
dictItem.label | ||
}}</a-tag> | ||
<a-tag v-else :color="dictItem.color">{{ dictItem.label }}</a-tag> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { computed } from 'vue'; | ||
import { LabelValueState } from '@/store/modules/dict/types'; | ||
const props = defineProps({ | ||
dict: { | ||
type: Array<LabelValueState>, | ||
required: true, | ||
}, | ||
value: { | ||
type: [Number, String], | ||
required: true, | ||
}, | ||
}); | ||
const dictItem = computed(() => | ||
props.dict.find( | ||
(d) => d.value === String(props.value) || d.value === Number(props.value) | ||
) | ||
); | ||
</script> | ||
|
||
<script lang="ts"> | ||
export default { | ||
name: 'DictTag', | ||
}; | ||
</script> | ||
|
||
<style scoped lang="less"></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
export interface LabelValueState { | ||
label: string; | ||
value: any; | ||
color?: string; | ||
} | ||
|
||
export interface DictState { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.