This commit is contained in:
@jyuhsin
2025-09-05 17:04:50 +08:00
parent ed940f1b7f
commit 91be38bb52
3 changed files with 37 additions and 24 deletions
@@ -9,7 +9,7 @@ import lombok.Getter;
@Getter @Getter
@DictEnum(key = "ProcessInstanceStateEnum", name = "流程实例状态") @DictEnum(key = "ProcessInstanceStateEnum", name = "流程实例状态")
public enum ProcessInstanceStateEnum { public enum ProcessInstanceStateEnum {
DOING(10, "进行中", null), DOING(10, "进行中", "primary"),
FINISHED(20, "已完成", "success"), FINISHED(20, "已完成", "success"),
WITHDRAW(30, "已撤回", "danger"), WITHDRAW(30, "已撤回", "danger"),
INTERRUPT(40, "强行终止", "danger"), INTERRUPT(40, "强行终止", "danger"),
@@ -91,11 +91,7 @@ public class CommonServiceImpl extends BaseServiceImpl implements CommonService
public <T> List<Sys_user> findUserInfoByRoleCode(PFun<T, ?> name, String columnValue, RoleConstant... roleConstant) { public <T> List<Sys_user> findUserInfoByRoleCode(PFun<T, ?> name, String columnValue, RoleConstant... roleConstant) {
String column = LambdaQuery.resolve(name); String column = LambdaQuery.resolve(name);
List<String> list = Arrays.stream(roleConstant).map(o -> { List<String> list = Arrays.stream(roleConstant).map(Enum::name).toList();
Sys_role role = sysRoleService.getByCode(o.name());
return role.getId();
}).toList();
return findUserInfoByRoleCode(column, columnValue, list); return findUserInfoByRoleCode(column, columnValue, list);
} }
@@ -1,17 +1,10 @@
<template> <template>
<div> <div>
<template v-if="mode === 'pc'" v-for="item in options"> <template v-for="item in options">
<el-tag :key="item[value_key]" v-if="item[value_key] === value" v-bind="$attrs" <component :key="item[value_key]" v-if="item[value_key] === value" v-bind="$attrs"
:type="item.type" :is="isMobile ? 'van-tag' : 'el-tag'" :type="item.type"
>{{ item[label_key] }} >{{ item[label_key] }}
</el-tag> </component>
</template>
<template v-if="mode === 'h5'" v-for="item in options">
<van-tag :key="item[value_key]" v-if="item[value_key] === value" v-bind="$attrs"
:type="item.type">
{{ item[label_key] }}
</van-tag>
</template> </template>
</div> </div>
</template> </template>
@@ -34,14 +27,11 @@ module.exports = {
type: String, type: String,
default: "name" default: "name"
}, },
mode: {
type: String,
default: "pc"
}
}, },
data() { data() {
return { return {
options: [] options: [],
isMobile: true,
} }
}, },
watch: { watch: {
@@ -53,6 +43,11 @@ module.exports = {
} }
}, },
methods: { methods: {
isMobileDevice() {
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
navigator.userAgent
);
},
getEnumOptions() { getEnumOptions() {
// // 检查数据缓存 // // 检查数据缓存
// if (enumCache[this.name]) { // if (enumCache[this.name]) {
@@ -86,7 +81,7 @@ module.exports = {
} }
}, },
created() { created() {
this.isMobile = this.isMobileDevice()
} }
} }
</script> </script>
@@ -96,6 +91,28 @@ module.exports = {
margin-left: 10px; margin-left: 10px;
} }
.van-tag { .van-tag {
padding: 4px 8px; height: 24px;
padding: 0 8px;
line-height: 22px;
}
.van-tag--success {
background-color: #f0f9eb;
border-color: #e1f3d8;
color: #67c23a;
}
.van-tag--primary {
color: var(--color-primary);
background-color: #ecf5ff;
border-color: #d9ecff;
}
.van-tag--danger{
background-color: #fef0f0;
border-color: #fde2e2;
color: #f56c6c;
}
.van-tag--warning{
background-color: #fdf6ec;
border-color: #faecd8;
color: #e6a23c;
} }
</style> </style>