update 代码高亮设置

This commit is contained in:
LiuHao 2024-01-26 01:16:22 +08:00
parent e4aa650f65
commit e78e4aaf5a
6 changed files with 99 additions and 18 deletions

View File

@ -1,4 +1,6 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { UserVO } from '@/api/system/user/types';
/**
*
@ -27,10 +29,10 @@ export const getWorkflowDeleteMultiInstanceList = (taskId: string) => {
/**
* id查询用户
* @param query
* @param userIdList
* @returns {*}
*/
export const getUserListByIds = (userIdList: Array<any>) => {
export const getUserListByIds = (userIdList: any[]): AxiosPromise<UserVO[]> => {
return request({
url: '/workflow/user/getUserListByIds/' + userIdList,
method: 'get'

View File

@ -1,7 +1,7 @@
<template>
<div>
<el-form ref="formRef" size="small" :model="formData" :rules="formRules" label-width="90px">
<el-collapse>
<el-collapse v-model="currentCollapseItem">
<el-collapse-item name="1">
<template #title>
<div class="collapse__title">
@ -42,13 +42,13 @@
</el-select>
</el-form-item>
<el-form-item v-if="formData.auditUserType === AuditUserTypeEnum.USER && showConfig.users" style="">
<el-badge :value="formData.users.length" :max="99">
<el-badge :value="selectUserLength" :max="99">
<el-button type="primary" @click="openUserSelect">选择人员</el-button>
<UserSelect ref="userSelectRef" v-model="formData.users"></UserSelect>
</el-badge>
</el-form-item>
<el-form-item v-if="formData.auditUserType === AuditUserTypeEnum.ROLE && showConfig.roles" style="">
<el-badge :value="formData.roles.length" :max="99">
<el-badge :value="selectRoleLength" :max="99">
<el-button type="primary" @click="openUserSelect">选择角色</el-button>
<RoleSelect ref="userSelectRef" v-model="formData.roles"></RoleSelect>
</el-badge>
@ -131,6 +131,10 @@ import { Element, Modeler } from 'bpmn';
import { TaskPanel } from 'bpmnDesign';
import { AuditUserTypeEnum, MultipleUserAuditTypeEnum, SpecifyDescEnum } from '@/enums/bpmn/IndexEnums';
import { BellFilled, Checked, InfoFilled } from '@element-plus/icons-vue';
import { getUserListByIds } from '@/api/workflow/workflowUser';
import { UserVO } from '@/api/system/user/types';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
interface PropType {
modeler: Modeler;
@ -147,8 +151,8 @@ const { parse, formData } = useParseElement<TaskPanel>({
initData: {
id: '',
name: '',
users: [],
roles: [],
// users: [],
// roles: [],
dueDate: '',
multipleUserAuditType: MultipleUserAuditTypeEnum.SERIAL,
auditUserType: AuditUserTypeEnum.USER,
@ -156,6 +160,7 @@ const { parse, formData } = useParseElement<TaskPanel>({
}
});
const currentCollapseItem = ref(['1', '2']);
const userSelectRef = ref<InstanceType<typeof UserSelect>>();
const dueDateRef = ref<InstanceType<typeof DueDate>>();
const openUserSelect = () => {
@ -168,7 +173,20 @@ const openDueDate = () => {
const syncChange = (newVal) => {
updateProperties({ 'flowable:async': newVal });
};
const selectUserLength = computed(() => {
if (formData.value.users) {
return formData.value.users.length;
} else {
return 0;
}
});
const selectRoleLength = computed(() => {
if (formData.value.roles) {
return formData.value.roles.length;
} else {
return 0;
}
});
watch(
() => formData.value.auditUserType,
(val, oldVal) => {
@ -179,7 +197,7 @@ watch(
watch(
() => formData.value.roles,
(newVal: Record<string, any>[]) => {
if (newVal.length > 0) {
if (newVal?.length > 0) {
// userId ,
const roleIds = newVal.map((item) => item.roleId).join(',');
updateProperties({ 'flowable:candidateGroups': roleIds });
@ -191,14 +209,15 @@ watch(
);
watch(
() => formData.value.users,
(newVal: Record<string, any>[]) => {
if (newVal.length === 1) {
(newVal: UserVO[]) => {
console.log(newVal);
if (newVal?.length === 1) {
const user = newVal[0];
const userId = user.userId;
updateProperties({ 'flowable:assignee': userId });
updateProperties({ 'flowable:candidateUsers': undefined });
//
} else if (newVal.length > 1) {
} else if (newVal?.length > 1) {
// userId ,
const userIds = newVal.map((item) => item.userId).join(',');
updateProperties({ 'flowable:candidateUsers': userIds });
@ -210,7 +229,56 @@ watch(
},
{ deep: true }
);
watch(
() => formData.value.async,
(newVal: boolean) => {
if (newVal) {
updateProperties({ 'flowable:async': true });
} else {
updateProperties({ 'flowable:async': undefined });
}
}
);
watch(
() => formData.value.skipExpression,
(newVal: string) => {
if (newVal) {
updateProperties({ 'flowable:skipExpression': newVal });
} else {
updateProperties({ 'flowable:skipExpression': undefined });
}
}
);
watch(
() => formData.value.priority,
(newVal: number) => {
if (newVal) {
updateProperties({ 'flowable:priority': newVal });
} else {
updateProperties({ 'flowable:priority': undefined });
}
}
);
watch(
() => formData.value.dueDate,
(newVal: string) => {
if (newVal) {
updateProperties({ 'flowable:dueDate': newVal });
} else {
updateProperties({ 'flowable:dueDate': undefined });
}
}
);
const initUsers = async () => {
if (formData.value.candidateUsers) {
const userIds = formData.value.candidateUsers.split(',');
const res = await getUserListByIds(userIds);
formData.value.users = res.data;
}
};
onBeforeMount(() => {
initUsers();
});
const formRules = ref<ElFormRules>({
id: [{ required: true, message: '请输入', trigger: 'blur' }],
name: [{ required: true, message: '请输入', trigger: 'blur' }]

View File

@ -80,9 +80,11 @@ import { RoleVO, RoleQuery } from '@/api/system/role/types';
import { VxeTableInstance } from 'vxe-table';
import useDialog from '@/hooks/useDialog';
interface PropType {
modelValue: RoleVO[];
modelValue?: RoleVO[];
}
const prop = defineProps<PropType>();
const prop = withDefaults(defineProps<PropType>(), {
modelValue: () => []
});
const emit = defineEmits(['update:modelValue']);
const router = useRouter();

View File

@ -112,9 +112,11 @@ import { VxeTableInstance } from 'vxe-table';
import useDialog from '@/hooks/useDialog';
interface PropType {
modelValue: UserVO[];
modelValue?: UserVO[];
}
const prop = defineProps<PropType>();
const prop = withDefaults(defineProps<PropType>(), {
modelValue: () => []
});
const emit = defineEmits(['update:modelValue']);
const { proxy } = getCurrentInstance() as ComponentInternalInstance;

View File

@ -37,7 +37,7 @@ declare module 'bpmnDesign' {
users?: Record<string, any>[];
roles?: Record<string, any>[];
async?: boolean;
priority?: string;
priority?: number;
skipExpression?: string;
isForCompensation?: boolean;
triggerServiceTask?: boolean;
@ -47,6 +47,10 @@ declare module 'bpmnDesign' {
exclude?: boolean;
class?: string;
dueDate?: string;
candidateUsers?: string;
assignee?: string;
candidateGroups?: string;
}
export interface StartEndPanel extends BasePanel {}

View File

@ -73,6 +73,9 @@ export default defineConfig(({ mode, command }: ConfigEnv): UserConfig => {
'diagram-js/lib/draw/BaseRenderer',
'tiny-svg',
'element-plus/es/components/collapse-item/style/css',
'element-plus/es/components/collapse/style/css',
'element-plus/es/components/space/style/css',
'element-plus/es/components/container/style/css',
'element-plus/es/components/aside/style/css',
'element-plus/es/components/main/style/css',