update:cid修复
This commit is contained in:
@@ -107,12 +107,15 @@ const props = defineProps({
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'change']);
|
||||
// const emit = defineEmits(['change']);
|
||||
const emit = defineEmits<{
|
||||
(e: 'change', fileList: IUploadFile[]): void;
|
||||
}>();
|
||||
|
||||
const fileAccept = computed(() => {
|
||||
return props.fileType.map(item => `.${item}`).join(',')
|
||||
})
|
||||
const fileList = defineModel({ type: Array as PropType<IUploadFile[]>, default: () => [] });
|
||||
return props.fileType.map((item) => `.${item}`).join(',');
|
||||
});
|
||||
const fileList = defineModel('modelValue', { type: Array as PropType<IUploadFile[]>, default: () => [] });
|
||||
|
||||
const uploadList = computed<UploadUserFile>(() => {
|
||||
return fileList.value.map((item) => {
|
||||
@@ -176,8 +179,8 @@ const handleUpload: UploadRequestHandler = (options) => {
|
||||
const uploadEvent = Object.create(baseEvent) as UploadProgressEvent;
|
||||
uploadEvent.percent = percent;
|
||||
|
||||
options.onProgress(uploadEvent)
|
||||
}
|
||||
options.onProgress(uploadEvent);
|
||||
};
|
||||
return uploadFile(options.file, onProgress).then((res) => {
|
||||
if (res.success || res.ok) {
|
||||
return res.data;
|
||||
@@ -189,11 +192,13 @@ const handleUpload: UploadRequestHandler = (options) => {
|
||||
|
||||
// 上传成功回调
|
||||
function handleUploadSuccess(response: IUploadFile, uploadFile: UploadFile, uploadFiles: UploadFiles) {
|
||||
fileList.value.push(response);
|
||||
fileList.value = [...fileList.value, response];
|
||||
emit('change', fileList.value);
|
||||
}
|
||||
|
||||
const handleRemove = (file: UploadFile) => {
|
||||
fileList.value = fileList.value.filter((f) => !(f.url === file.url));
|
||||
emit('change', fileList.value);
|
||||
};
|
||||
|
||||
const handlePreview = (file: UploadFile) => {
|
||||
|
||||
@@ -10,11 +10,12 @@
|
||||
</div>
|
||||
<el-checkbox
|
||||
v-if="formatChildDepartments.length > 0 || formatUserList.length > 0"
|
||||
v-model="selectAllChecked"
|
||||
class="flex items-center pl-2 mt-3"
|
||||
:modelValue="selectAllChecked"
|
||||
:indeterminate="indeterminate"
|
||||
@change="selectAll"
|
||||
>
|
||||
<div class="flex items-center">{{ $t('components.DeptList.0910548-0') }}</div>
|
||||
<div class="flex items-center">全选</div>
|
||||
</el-checkbox>
|
||||
<UseVirtualList height="220px" :list="list" :options="{ itemHeight: 48 }">
|
||||
<template #default="props">
|
||||
@@ -25,20 +26,20 @@
|
||||
{{ props.data.nickname || props.data.name }}
|
||||
</div>
|
||||
</el-checkbox>
|
||||
<el-button type="primary" text :disabled="props.data.checked" @click="nextDept(props.data)">{{
|
||||
$t('OrgSelector.selectBox.7635082-1')
|
||||
}}</el-button>
|
||||
</div>
|
||||
<div class="mb-2 mt-2 pl-2" v-else>
|
||||
<el-checkbox
|
||||
:model-value="props.data.checked"
|
||||
:disabled="disabledIdList.includes(props.data?.id)"
|
||||
class="flex items-center"
|
||||
@change="changeSelect(props.data)"
|
||||
>
|
||||
<UserInfoRender class="ml-2" :name="props.data.nickname || props.data.name" :avatar="props.data.avatar" size="small" />
|
||||
</el-checkbox>
|
||||
<el-button v-if="isEmployee" type="primary" text :disabled="props.data.checked" @click="nextDept(props.data)">下级</el-button>
|
||||
</div>
|
||||
<template v-else>
|
||||
<div class="mb-2 mt-2 pl-2">
|
||||
<el-checkbox
|
||||
:model-value="props.data.checked"
|
||||
:disabled="disabledIdList.includes(props.data?.id)"
|
||||
class="flex items-center"
|
||||
@change="changeSelect(props.data)"
|
||||
>
|
||||
<UserInfoRender class="ml-2" :name="props.data.nickname || props.data.name" :avatar="props.data.avatar" size="small" />
|
||||
</el-checkbox>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</UseVirtualList>
|
||||
</div>
|
||||
@@ -56,11 +57,11 @@ const { currentTenant } = storeToRefs(tenantStore);
|
||||
const props = defineProps<{
|
||||
data: any[];
|
||||
deptDisabled?: boolean;
|
||||
isEmployee?: boolean;
|
||||
}>();
|
||||
// 定义emit
|
||||
const emit = defineEmits(['selectAll', 'change']);
|
||||
const disabledIdList = inject<string[]>('disabledIdList', []);
|
||||
const selectAllChecked = ref(false);
|
||||
|
||||
const childDepartments = ref<any[]>([]);
|
||||
const formatChildDepartments = computed(() => {
|
||||
@@ -73,6 +74,9 @@ const formatChildDepartments = computed(() => {
|
||||
});
|
||||
const userList = ref<any[]>([]);
|
||||
const formatUserList = computed(() => {
|
||||
if (!props.isEmployee) {
|
||||
return [];
|
||||
}
|
||||
return userList.value.map((user) => {
|
||||
return {
|
||||
...user,
|
||||
@@ -80,6 +84,7 @@ const formatUserList = computed(() => {
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
// 部门名称列表
|
||||
const deptNameList = ref<any[]>([
|
||||
{
|
||||
@@ -92,26 +97,36 @@ const list = computed(() => {
|
||||
return [...formatChildDepartments.value, ...formatUserList.value];
|
||||
});
|
||||
|
||||
const selectAllChecked = computed(() => {
|
||||
return list.value.filter((item) => !disabledIdList.includes(item?.id)).every((item) => item.checked);
|
||||
});
|
||||
const indeterminate = computed(() => {
|
||||
const checkedCount = list.value.filter((item) => !disabledIdList.includes(item?.id) && item.checked).length;
|
||||
return checkedCount > 0 && checkedCount < list.value.filter((item) => !disabledIdList.includes(item?.id)).length;
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
getDeptList(0);
|
||||
});
|
||||
|
||||
const selectAll = () => {
|
||||
const selectList: any[] = [];
|
||||
const selectAll = (e: boolean) => {
|
||||
if (!props.deptDisabled) {
|
||||
childDepartments.value.forEach((dept) => {
|
||||
dept.checked = selectAllChecked.value;
|
||||
selectList.push(dept)
|
||||
dept.checked = e;
|
||||
});
|
||||
}
|
||||
userList.value.forEach((user) => {
|
||||
if (!disabledIdList.includes(user.id)) {
|
||||
// 检查禁选
|
||||
user.checked = selectAllChecked.value;
|
||||
selectList.push(user)
|
||||
}
|
||||
});
|
||||
emit('selectAll', selectAllChecked.value, selectList);
|
||||
if (props.isEmployee) {
|
||||
userList.value.forEach((user) => {
|
||||
if (!disabledIdList.includes(user.id)) {
|
||||
// 检查禁选
|
||||
user.checked = e;
|
||||
}
|
||||
});
|
||||
}
|
||||
// 对外抛出勾选的数据
|
||||
const checkedDeptList = childDepartments.value.filter((item) => item.checked);
|
||||
const checkedUserList = props.isEmployee ? userList.value.filter((item) => !disabledIdList.includes(item.id) && item.checked) : [];
|
||||
emit('selectAll', e, [...checkedDeptList, ...checkedUserList]);
|
||||
};
|
||||
|
||||
const changeSelect = (item: any) => {
|
||||
|
||||
@@ -74,7 +74,7 @@ import DeptList from './DeptList.vue';
|
||||
import RoleList from './RoleList.vue';
|
||||
import UserCard from './UserCard.vue';
|
||||
import ProjectList from './ProjectList.vue';
|
||||
import throttle from 'lodash/throttle';
|
||||
import { throttle } from 'lodash-es';
|
||||
import UserAvatar from './assets/user.svg';
|
||||
import RoleAvatar from './assets/role_avatar.png';
|
||||
import DeptAvatar from './assets/dept_avatar.png';
|
||||
@@ -109,11 +109,6 @@ const props = defineProps({
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
disabledIdList: {
|
||||
type: Array as PropType<string[]>,
|
||||
required: false,
|
||||
default: () => [],
|
||||
},
|
||||
roleConfig: {
|
||||
type: Object as PropType<IRoleConfig>,
|
||||
default: () => ({
|
||||
@@ -122,7 +117,12 @@ const props = defineProps({
|
||||
allowTopSelectAll: true,
|
||||
}),
|
||||
},
|
||||
disabledIdList: {
|
||||
type: Array as PropType<string[]>,
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
provide('disabledIdList', props.disabledIdList);
|
||||
// 汇总展示
|
||||
const checkedList = useVModel(props, 'checkedList', emit);
|
||||
const username = ref('');
|
||||
@@ -297,7 +297,7 @@ const selectAllDept = (selectAllChecked: boolean, deptList: any[]) => {
|
||||
});
|
||||
} else {
|
||||
// 移除checkedList中deptList的元素
|
||||
checkedList.value = checkedList.value.filter((item: any) => !deptList.some((dept: any) => dept.id === item.id));
|
||||
checkedList.value = deptList.length ? checkedList.value.filter((item: any) => !deptList.some((dept: any) => dept.id === item.id)) : [];
|
||||
}
|
||||
};
|
||||
|
||||
@@ -308,7 +308,6 @@ const deleteUser = (user: any) => {
|
||||
});
|
||||
};
|
||||
|
||||
provide('disabledIdList', props.disabledIdList);
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -1,50 +1,19 @@
|
||||
<template>
|
||||
<div class="role-list">
|
||||
<p class="mt-5 pl-2 flex items-center">
|
||||
<span class="cursor-pointer text-black" :class="{ 'text-gray-500': !!currentRole }" @click="changeCurrentRole(null)">{{
|
||||
$t('mold.addRoleMemberAllTitle')
|
||||
}}</span>
|
||||
<template v-if="currentRole">
|
||||
<el-icon class="mr-2 ml-2"><ArrowRight /></el-icon>
|
||||
<span>{{ currentRole.roleName }}</span>
|
||||
</template>
|
||||
</p>
|
||||
<div class="mt-2 h-[300px] overflow-y-auto">
|
||||
<template v-if="currentRole">
|
||||
<div v-if="roleMemberMap[currentRole.roleId]">
|
||||
<el-checkbox v-model="selectAllMembersChecked" class="flex items-center pl-2 mt-3" @change="selectAllMemberInRole">
|
||||
<div class="flex items-center">
|
||||
{{ $t('components.DeptList.0910548-0') }}
|
||||
</div>
|
||||
</el-checkbox>
|
||||
<div v-for="item in formateMembers" :key="item.id" class="mb-2 mt-2 px-2 flex items-center justify-between">
|
||||
<el-checkbox
|
||||
:model-value="item.checked"
|
||||
:disabled="disabledIdList.includes(item.id)"
|
||||
class="flex items-center"
|
||||
@change="selectMember(item, $event)"
|
||||
>
|
||||
<UserInfoRender class="ml-2" :name="item.nickname || item.name" :avatar="item.avatar" size="small" />
|
||||
</el-checkbox>
|
||||
</div>
|
||||
<el-checkbox :modelValue="selectAllChecked" :indeterminate="indeterminate" class="flex items-center pl-2 mt-3" @change="selectAll">
|
||||
<div class="flex items-center">
|
||||
{{ $t('components.DeptList.0910548-0') }}
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-checkbox v-if="config.allowTopSelectAll" v-model="selectAllChecked" class="flex items-center pl-2 mt-3" @change="selectAll">
|
||||
</el-checkbox>
|
||||
<div class="mb-2 mt-2 pl-2" v-for="item in formatRoleList" :key="item.roleId">
|
||||
<el-checkbox :model-value="item.checked" class="flex items-center" @change="selectRole(item)">
|
||||
<div class="flex items-center">
|
||||
{{ $t('components.DeptList.0910548-0') }}
|
||||
<el-image class="w-6 mr-3" :src="roleAvatar" fit="fill" />
|
||||
{{ item.roleName }}
|
||||
</div>
|
||||
</el-checkbox>
|
||||
<div class="mb-2 mt-2 pl-2 flex justify-between items-center" v-for="item in formatRoleList" :key="item.roleId">
|
||||
<el-checkbox :model-value="item.checked" :disabled="config.roleDisabled" class="flex items-center" @change="selectRole(item)">
|
||||
<div class="flex items-center">
|
||||
<el-image class="w-6 mr-3" :src="roleAvatar" fit="fill" />
|
||||
{{ item.roleName }}
|
||||
</div>
|
||||
</el-checkbox>
|
||||
<el-button v-if="config.showUser" link type="primary" @click="changeCurrentRole(item)">展开</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -52,34 +21,15 @@
|
||||
<script setup lang="ts">
|
||||
import { getTenantRoleList, ITenantRole } from '/@/api/admin/role';
|
||||
import roleAvatar from './assets/role_avatar.png';
|
||||
import { SourcePickerTypeEnum } from './type.d';
|
||||
import { getStaffsByRoleIdList } from '/@/api/admin/staffManage';
|
||||
import type { IRoleConfig } from './type';
|
||||
|
||||
interface ITenantRoleChecked extends ITenantRole {
|
||||
checked?: boolean;
|
||||
}
|
||||
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Array as PropType<any[]>,
|
||||
default: () => [],
|
||||
},
|
||||
userData: {
|
||||
type: Array as PropType<any[]>,
|
||||
default: () => [],
|
||||
},
|
||||
config: {
|
||||
type: Object as PropType<IRoleConfig>,
|
||||
default: () => ({
|
||||
showUser: false,
|
||||
roleDisabled: false,
|
||||
allowTopSelectAll: true,
|
||||
}),
|
||||
},
|
||||
});
|
||||
const props = defineProps<{
|
||||
data: any[];
|
||||
}>();
|
||||
|
||||
const selectAllChecked = ref(false);
|
||||
const roleList = ref<ITenantRoleChecked[]>([]);
|
||||
const formatRoleList = computed(() => {
|
||||
return roleList.value.map((role) => {
|
||||
@@ -89,53 +39,13 @@ const formatRoleList = computed(() => {
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
const disabledIdList = inject<string[]>('disabledIdList', []);
|
||||
const currentRole = ref<ITenantRoleChecked>();
|
||||
const roleMemberMap = ref<Record<string, any>>({});
|
||||
const selectAllMembersChecked = ref(false);
|
||||
|
||||
const checkedUserIdMap = computed(() =>
|
||||
props.userData.reduce((acc: Record<string, any>, item: any) => {
|
||||
acc[item.id] = item;
|
||||
return acc;
|
||||
}, {})
|
||||
);
|
||||
// 某角色下的成员
|
||||
const formateMembers = computed(() => {
|
||||
const members = roleMemberMap.value[currentRole.value?.roleId ?? ''] ?? [];
|
||||
return members.map((m: any) => {
|
||||
const checked = checkedUserIdMap.value[m.userId];
|
||||
console.log('formate members', checked, checkedUserIdMap.value);
|
||||
return {
|
||||
id: m.userId,
|
||||
name: m.sysUserOnTenantVO?.nickname || m.sysUserOnTenantVO?.username,
|
||||
avatar: m.sysUserOnTenantVO?.avatar,
|
||||
type: SourcePickerTypeEnum.user,
|
||||
checked: !!checked,
|
||||
};
|
||||
});
|
||||
const selectAllChecked = computed(() => {
|
||||
return formatRoleList.value.every((item) => item.checked);
|
||||
});
|
||||
const indeterminate = computed(() => {
|
||||
const checkedCount = formatRoleList.value.filter((item) => item.checked).length;
|
||||
return checkedCount > 0 && checkedCount < formatRoleList.value.length;
|
||||
});
|
||||
|
||||
const selectAllMemberInRole = (checked: boolean) => {
|
||||
const members: any[] = [];
|
||||
formateMembers.value.forEach((item: any) => {
|
||||
if (!disabledIdList.includes(item.id)) {
|
||||
item.checked = checked;
|
||||
members.push(item);
|
||||
}
|
||||
});
|
||||
emit('selectAll', checked, members);
|
||||
// console.log('selectAllMemberInRole', formateMembers.value);
|
||||
};
|
||||
|
||||
const selectMember = (item: any, checked: boolean) => {
|
||||
console.log('selectMember', item, checked);
|
||||
emit('change', {
|
||||
...item,
|
||||
checked,
|
||||
});
|
||||
};
|
||||
|
||||
// 定义emit
|
||||
const emit = defineEmits(['change', 'selectAll']);
|
||||
@@ -145,7 +55,7 @@ onMounted(() => {
|
||||
roleList.value = res.data.map((item: any) => {
|
||||
return {
|
||||
...item,
|
||||
type: SourcePickerTypeEnum.role,
|
||||
type: 2,
|
||||
id: item.roleId,
|
||||
name: item.roleName,
|
||||
};
|
||||
@@ -153,12 +63,11 @@ onMounted(() => {
|
||||
});
|
||||
});
|
||||
|
||||
const selectAll = () => {
|
||||
console.log('selectAll', selectAllChecked.value);
|
||||
const selectAll = (e: boolean) => {
|
||||
roleList.value.forEach((item) => {
|
||||
item.checked = selectAllChecked.value;
|
||||
item.checked = e;
|
||||
});
|
||||
emit('selectAll', selectAllChecked.value, roleList.value);
|
||||
emit('selectAll', e, roleList.value);
|
||||
};
|
||||
|
||||
const selectRole = (item: any) => {
|
||||
@@ -167,26 +76,6 @@ const selectRole = (item: any) => {
|
||||
checked: !item.checked,
|
||||
});
|
||||
};
|
||||
|
||||
const changeCurrentRole = (item: any) => {
|
||||
currentRole.value = item;
|
||||
console.log('changeCurrentRole', item);
|
||||
if (item?.roleId) {
|
||||
// 查询当前角色下的成员
|
||||
queryUserByRoleId(item.roleId);
|
||||
}
|
||||
};
|
||||
|
||||
const queryUserByRoleId = async (id: string) => {
|
||||
if (!roleMemberMap.value[id]) {
|
||||
try {
|
||||
const res = await getStaffsByRoleIdList([id]);
|
||||
roleMemberMap.value[id] = res.data[id];
|
||||
} catch (error: any) {
|
||||
console.log('getMemberByProjectId', error);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
|
||||
@@ -19,9 +19,9 @@ export default {
|
||||
borderless
|
||||
expanded
|
||||
:initial-page="{
|
||||
month: new Date().getMonth() + 1,
|
||||
month: new Date().getMonth(),
|
||||
year: new Date().getFullYear(),
|
||||
week: getWeek(),
|
||||
week: new Date().getWeek() + 1,
|
||||
}"
|
||||
@did-move="weeknumberClick"
|
||||
@dayclick="dayClick"
|
||||
@@ -79,19 +79,12 @@ const locale = computed(() => {
|
||||
const masks = ref({
|
||||
weekdays: 'WWW',
|
||||
});
|
||||
|
||||
const getWeek = function () {
|
||||
const date = new Date();
|
||||
// 获取当前日期是本月的第几天
|
||||
const dayOfMonth = date.getDate();
|
||||
// 获取当前月份的第一天是星期几(0-6,0代表周日,1代表周一,...,6代表周六)
|
||||
const firstDay = new Date(date.getFullYear(), date.getMonth(), 1).getDay();
|
||||
// 将周日(0)转换为7,以便于计算
|
||||
const adjustedFirstDay = firstDay === 0 ? 7 : firstDay;
|
||||
// 计算当前日期是本月的第几周
|
||||
// 公式:当前日期 + (调整后的第一天星期几 - 1) 然后除以7向上取整
|
||||
// 减1是因为如果第一天是周一(1),那么它应该是第一周的开始
|
||||
return Math.ceil((dayOfMonth + adjustedFirstDay - 1) / 7);
|
||||
Date.prototype.getWeek = function () {
|
||||
const date = new Date(this.getTime());
|
||||
date.setHours(0, 0, 0, 0);
|
||||
date.setDate(date.getDate() + 3 - ((date.getDay() + 6) % 7));
|
||||
const week1 = new Date(date.getFullYear(), 0, 4);
|
||||
return 1 + Math.round(((date.getTime() - week1.getTime()) / 86400000 - 3 + ((week1.getDay() + 6) % 7)) / 7);
|
||||
};
|
||||
|
||||
const reminders = ref([]);
|
||||
|
||||
6
src/types/func.d.ts
vendored
6
src/types/func.d.ts
vendored
@@ -1,10 +1,10 @@
|
||||
// 定义全局属性的类型
|
||||
import { ComponentCustomProperties } from 'vue';
|
||||
|
||||
declare module '@vue/runtime-core' {
|
||||
declare module 'vue' {
|
||||
interface ComponentCustomProperties {
|
||||
parseTime: Function;
|
||||
parseDate: Function;
|
||||
parseTime: (time: string | number, pattern?: string) => string | null;
|
||||
parseDate: (time: string | number, pattern?: string) => string | null;
|
||||
dateTimeStr: string;
|
||||
dateStr: string;
|
||||
timeStr: string;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<div>
|
||||
<upload-file
|
||||
v-model="form.props.value"
|
||||
:disabled="form.perm === 'E'"
|
||||
<UploadFileNEw
|
||||
v-model="modelValue"
|
||||
:disabled="mode === 'D' || form.perm === 'R'"
|
||||
:fileSize="form.props.maxSize"
|
||||
:limit="form.props.max"
|
||||
:fileType="form.props.suffixArray"
|
||||
@@ -10,6 +10,9 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { uniqueId } from 'lodash';
|
||||
import UploadFileNEw from '/@/components/Upload/New.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
let props = defineProps({
|
||||
mode: {
|
||||
@@ -23,6 +26,27 @@ let props = defineProps({
|
||||
},
|
||||
});
|
||||
|
||||
const modelValue = computed({
|
||||
get() {
|
||||
const value = props.form.props?.value;
|
||||
if (typeof value === 'string') {
|
||||
const _val = value ? value.split(',').filter(Boolean) : [];
|
||||
return _val.map((i: string) => {
|
||||
return {
|
||||
fileName: i,
|
||||
url: i,
|
||||
fileSize: void 0,
|
||||
fileKey: uniqueId(),
|
||||
};
|
||||
});
|
||||
}
|
||||
return value || [];
|
||||
},
|
||||
set(val) {
|
||||
/** 需要改为emit */
|
||||
props.form.props.value = val;
|
||||
},
|
||||
});
|
||||
const getValidateRule = () => {
|
||||
var item = props.form;
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
</div>
|
||||
<p>{{ $t('flow.conditionalBranching') }}</p>
|
||||
</a>
|
||||
|
||||
<a class="add-node-popover-item ParallelGateway" @click="addType(5)">
|
||||
<div class="item-wrapper">
|
||||
<span class="iconfont"></span>
|
||||
|
||||
@@ -22,9 +22,10 @@
|
||||
</template>
|
||||
</div>
|
||||
<div class="content" @click="openConfigDrawer">
|
||||
<div class="text">
|
||||
<!-- <div class="text">
|
||||
{{ placeHolder?.length > 0 ? placeHolder : $t('Material.index.7635071-1') + defaultText }}
|
||||
</div>
|
||||
</div> -->
|
||||
<Tippy :label="placeHolder?.length > 0 ? placeHolder : $t('Material.index.7635071-1') + defaultText" />
|
||||
<i class="anticon anticon-right arrow"></i>
|
||||
</div>
|
||||
|
||||
@@ -55,7 +56,9 @@
|
||||
v-model="item.nodeName"
|
||||
/>
|
||||
<span v-else class="editable-title" @click="clickEvent(index)">{{ item.nodeName }}</span>
|
||||
<span class="priority-title" @click="openConfigDrawer(item.priorityLevel)">{{ $t('components.nodeWrap.09126447-2') }}{{ item.priorityLevel }}</span>
|
||||
<span class="priority-title" @click="openConfigDrawer(item.priorityLevel)"
|
||||
>{{ $t('components.nodeWrap.09126447-2') }}{{ item.priorityLevel }}</span
|
||||
>
|
||||
<i class="anticon anticon-close close" @click="delTerm(index)"></i>
|
||||
</div>
|
||||
<div class="sort-right" v-if="index != nodeConfig.conditionNodes.length - 1" @click="arrTransfer(index)">></div>
|
||||
@@ -142,10 +145,11 @@
|
||||
import addNode from './addNode.vue';
|
||||
import Approval from './node/approval.vue';
|
||||
|
||||
import {onMounted, ref, watch, getCurrentInstance, computed} from 'vue';
|
||||
import { onMounted, ref, watch, getCurrentInstance, computed } from 'vue';
|
||||
import $func from '../utils/index';
|
||||
import {useStore} from '../stores/index';
|
||||
import {bgColors, placeholderList} from '../utils/const';
|
||||
import { useStore } from '../stores/index';
|
||||
import { bgColors, placeholderList } from '../utils/const';
|
||||
import { useUserInfoMap } from '/@/components/UserInfo';
|
||||
|
||||
let _uid = getCurrentInstance().uid;
|
||||
|
||||
@@ -160,13 +164,14 @@ let defaultText = computed(() => {
|
||||
return placeholderList[props.nodeConfig.type];
|
||||
});
|
||||
|
||||
const {t} = useI18n();
|
||||
var placeHolder = computed(() => {
|
||||
const { t } = useI18n();
|
||||
const { userInfoMap } = storeToRefs(useUserInfoMap());
|
||||
const placeHolder = computed(() => {
|
||||
if (props.nodeConfig.type == 0) {
|
||||
return $func.arrToStr(props.nodeConfig.nodeUserList) || t('flow.allUser');
|
||||
}
|
||||
if (props.nodeConfig.type == 1) {
|
||||
return $func.setApproverStr(props.nodeConfig);
|
||||
return $func.setApproverStr(props.nodeConfig, userInfoMap.value);
|
||||
}
|
||||
if (props.nodeConfig.type == 2) {
|
||||
return $func.copyerStr(props.nodeConfig);
|
||||
@@ -178,7 +183,7 @@ watch(placeHolder, (value, oldValue, onCleanup) => {
|
||||
props.nodeConfig.placeHolder = value;
|
||||
});
|
||||
|
||||
import {useFlowStore} from '../stores/flow';
|
||||
import { useFlowStore } from '../stores/flow';
|
||||
import other from '/@/utils/other';
|
||||
|
||||
let flowStore = useFlowStore();
|
||||
@@ -272,7 +277,7 @@ onMounted(() => {
|
||||
});
|
||||
let emits = defineEmits(['update:nodeConfig']);
|
||||
let store = useStore();
|
||||
let {setPromoter, setApprover, setCopyer, setCondition, setStarterConfig, setApproverConfig, setCopyerConfig, setConditionsConfig} = store;
|
||||
let { setPromoter, setApprover, setCopyer, setCondition, setStarterConfig, setApproverConfig, setCopyerConfig, setConditionsConfig } = store;
|
||||
let starterConfigData = computed(() => store.starterConfigData);
|
||||
let approverConfigData = computed(() => store.approverConfigData);
|
||||
let copyerConfig1 = computed(() => store.copyerConfig1);
|
||||
@@ -315,7 +320,7 @@ const blurEvent = (index) => {
|
||||
props.nodeConfig.nodeName = props.nodeConfig.nodeName || defaultText;
|
||||
}
|
||||
};
|
||||
const {proxy} = getCurrentInstance();
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
const delNode = () => {
|
||||
emits('update:nodeConfig', props.nodeConfig.childNode);
|
||||
@@ -395,7 +400,7 @@ const reData = (data, addData) => {
|
||||
}
|
||||
};
|
||||
const openConfigDrawer = (priorityLevel) => {
|
||||
var {type} = props.nodeConfig;
|
||||
var { type } = props.nodeConfig;
|
||||
if (type == 0) {
|
||||
setPromoter(true);
|
||||
setStarterConfig({
|
||||
@@ -409,8 +414,8 @@ const openConfigDrawer = (priorityLevel) => {
|
||||
setApproverConfig({
|
||||
value: {
|
||||
...JSON.parse(JSON.stringify(props.nodeConfig)),
|
||||
...{assignedType: props.nodeConfig.assignedType ? props.nodeConfig.assignedType : 1},
|
||||
...{multiple: false},
|
||||
...{ assignedType: props.nodeConfig.assignedType ? props.nodeConfig.assignedType : 1 },
|
||||
...{ multiple: false },
|
||||
},
|
||||
flag: false,
|
||||
id: _uid,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {i18n} from '/@/i18n'
|
||||
import { i18n } from '/@/i18n';
|
||||
function All() {}
|
||||
|
||||
import { useFlowStore } from '../stores/flow';
|
||||
@@ -96,34 +96,48 @@ All.prototype = {
|
||||
|
||||
return true;
|
||||
},
|
||||
setApproverStr(nodeConfig) {
|
||||
setApproverStr(nodeConfig, userMap = {}) {
|
||||
if (nodeConfig.assignedType == 1) {
|
||||
//指定成员
|
||||
if (nodeConfig.nodeUserList.length >= 1) {
|
||||
return nodeConfig.nodeUserList.map((res) => res.name).join(',');
|
||||
} else {
|
||||
return '';
|
||||
return nodeConfig.nodeUserList.map((res) => userMap[res.id]?.nickname).join(', ');
|
||||
}
|
||||
} else if (nodeConfig.assignedType == 3) {
|
||||
return '';
|
||||
}
|
||||
if (nodeConfig.assignedType == 3) {
|
||||
//指定角色
|
||||
if (nodeConfig.nodeUserList.length >= 1) {
|
||||
return nodeConfig.nodeUserList.map((res) => res.name).join(',');
|
||||
} else {
|
||||
return '';
|
||||
return nodeConfig.nodeUserList.map((res) => res.name).join(', ');
|
||||
}
|
||||
} else if (nodeConfig.assignedType == 2) {
|
||||
return nodeConfig.deptLeaderLevel == 1 ? i18n.global.t('utils.index.09125420-1') : i18n.global.t('Crontab.index.7634731-32') + nodeConfig.deptLeaderLevel + i18n.global.t('utils.index.09125420-3');
|
||||
} else if (nodeConfig.assignedType == 4) {
|
||||
return '';
|
||||
}
|
||||
if (nodeConfig.assignedType == 2) {
|
||||
if (nodeConfig.deptLeaderLevel == 1) {
|
||||
return `${i18n.global.t('utils.index.09125420-1')}: ${nodeConfig.nodeUserList.map((res) => res.name).join(', ')}`;
|
||||
}
|
||||
return i18n.global.t('Crontab.index.7634731-32') + nodeConfig.deptLeaderLevel + i18n.global.t('utils.index.09125420-3');
|
||||
}
|
||||
if (nodeConfig.assignedType == 4) {
|
||||
//发起人自选
|
||||
return i18n.global.t('utils.const.09125419-6');
|
||||
} else if (nodeConfig.assignedType == 5) {
|
||||
}
|
||||
if (nodeConfig.assignedType == 5) {
|
||||
return i18n.global.t('utils.const.09125419-7');
|
||||
} else if (nodeConfig.assignedType == 7) {
|
||||
}
|
||||
if (nodeConfig.assignedType == 7) {
|
||||
return i18n.global.t('drawer.approverDrawer.09126452-8') + nodeConfig.deptLeaderLevel + i18n.global.t('drawer.approverDrawer.09126452-9');
|
||||
} else if (nodeConfig.assignedType == 8 && nodeConfig.formUserId.length > 0) {
|
||||
}
|
||||
if (nodeConfig.assignedType == 8 && nodeConfig.formUserId.length > 0) {
|
||||
//表单
|
||||
return i18n.global.t('utils.index.09125420-8') + nodeConfig.formUserName;
|
||||
}
|
||||
if (nodeConfig.assignedType == 9) {
|
||||
//项目角色
|
||||
if (nodeConfig.nodeUserList.length >= 1) {
|
||||
return nodeConfig.nodeUserList.map((res) => res.name).join(', ');
|
||||
}
|
||||
return '';
|
||||
}
|
||||
return '';
|
||||
},
|
||||
dealStr(str, obj) {
|
||||
@@ -162,7 +176,7 @@ All.prototype = {
|
||||
if (valueElement.type === 'SelectUser' || valueElement.type === 'SelectDept') {
|
||||
valueShow = value.map((res) => res.name).join(',');
|
||||
} else if (valueElement.type === 'SingleSelect') {
|
||||
valueShow = value.map(res=>res.value).join(",")
|
||||
valueShow = value.map((res) => res.value).join(',');
|
||||
} else {
|
||||
if (!valueShow) {
|
||||
valueShow = '?';
|
||||
@@ -186,9 +200,9 @@ All.prototype = {
|
||||
} else if (expression === '<=') {
|
||||
conArr.push(name + ' 小于等于 ' + valueShow);
|
||||
} else if (expression === 'contain') {
|
||||
conArr.push(name + " 包含 " + valueShow);
|
||||
conArr.push(name + ' 包含 ' + valueShow);
|
||||
} else if (expression === 'notcontain') {
|
||||
conArr.push(name + " 不包含 " + valueShow);
|
||||
conArr.push(name + ' 不包含 ' + valueShow);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user