|
|
@@ -90,179 +90,179 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { onMounted, ref, reactive, watch, watchEffect } from 'vue';
|
|
|
-import SelectTree from '../persongroup/components/SelectTree.vue';
|
|
|
-import Group from './Group.vue';
|
|
|
-import { recipientTypeName } from '../constant';
|
|
|
-import { ToPushObjectqueryUserGroupList, queryUserGroupDetail } from '../api/index';
|
|
|
-import type { FormInstance } from 'element-plus';
|
|
|
-import { GroupData } from '../persongroup/type';
|
|
|
-const ruleFormRef = ref<FormInstance>();
|
|
|
-const groupInfo = ref<boolean>(false);
|
|
|
-const userInfo = ref<boolean>(false);
|
|
|
-const disabled = ref<boolean>(false);
|
|
|
-interface customUserList {
|
|
|
- userId: number;
|
|
|
- userLoginName: string;
|
|
|
- userNickname: string;
|
|
|
- userNumber: string;
|
|
|
-}
|
|
|
-interface userGroupVOList {
|
|
|
- userGroupId: number;
|
|
|
- total: number;
|
|
|
- operatorName: string;
|
|
|
- operationTime: string;
|
|
|
- name: string;
|
|
|
- description: string;
|
|
|
-}
|
|
|
-interface UserList {
|
|
|
- id: string;
|
|
|
- name: string;
|
|
|
- userId: number;
|
|
|
-}
|
|
|
-const selectedUser = ref<UserList[]>([]);
|
|
|
-interface RuleForm {
|
|
|
- recipientType?: number;
|
|
|
- userGroupList: number[];
|
|
|
- customUserList: UserList[];
|
|
|
-}
|
|
|
-const ruleForm = reactive<RuleForm>({
|
|
|
- userGroupList: [],
|
|
|
- customUserList: [],
|
|
|
-});
|
|
|
-const props = defineProps<{
|
|
|
- recipientType?: number;
|
|
|
- userGroupList?: userGroupVOList[];
|
|
|
- customUserList?: customUserList[];
|
|
|
- disabled?: boolean;
|
|
|
-}>();
|
|
|
-interface Options {
|
|
|
- userGroupId?: number;
|
|
|
- name?: string;
|
|
|
- description: string;
|
|
|
- total: number;
|
|
|
- operatorName: string;
|
|
|
- operationTime: string;
|
|
|
-}
|
|
|
-const options = ref<Options[]>([]);
|
|
|
-const userGroupInfo = ref<GroupData[]>();
|
|
|
-const queryGroupInfo = (groupList) => {
|
|
|
- groupInfo.value = true;
|
|
|
- queryUserGroupDetail(groupList).then((res) => {
|
|
|
- userGroupInfo.value = res.map((group) => ({
|
|
|
- ...group,
|
|
|
- isExpand: false,
|
|
|
- isHidden: false,
|
|
|
- }));
|
|
|
- });
|
|
|
-};
|
|
|
-const submitForm = () => {
|
|
|
- return ruleFormRef.value!.validate(() => {});
|
|
|
-};
|
|
|
-const getChildValue = () => {
|
|
|
- return {
|
|
|
- recipientType: ruleForm.recipientType,
|
|
|
- userGroupList:
|
|
|
- ruleForm.recipientType === 3
|
|
|
- ? []
|
|
|
- : ruleForm.recipientType === 1
|
|
|
- ? []
|
|
|
- : ruleForm.userGroupList.map((item) => item),
|
|
|
- customUserList:
|
|
|
- ruleForm.recipientType === 2
|
|
|
- ? []
|
|
|
- : ruleForm.recipientType === 1
|
|
|
- ? []
|
|
|
- : ruleForm.customUserList.map((item) => item.userId),
|
|
|
- };
|
|
|
-};
|
|
|
-const handleCancle = () => {
|
|
|
- userInfo.value = false;
|
|
|
-};
|
|
|
-const handleSubmit = (selectedData: UserList[]) => {
|
|
|
- selectedUser.value = selectedData;
|
|
|
- ruleForm.customUserList = selectedUser.value;
|
|
|
- userInfo.value = false;
|
|
|
-};
|
|
|
-const formatCustomUserList = (customList: customUserList[]): UserList[] => {
|
|
|
- return customList.map((item) => ({
|
|
|
- id: `u${item.userId}`,
|
|
|
- userId: item.userId,
|
|
|
- name: `${item.userLoginName}-${item.userNickname}`,
|
|
|
- }));
|
|
|
-};
|
|
|
-defineExpose({
|
|
|
- submitForm,
|
|
|
- getChildValue,
|
|
|
-});
|
|
|
-onMounted(() => {
|
|
|
- ToPushObjectqueryUserGroupList().then((res) => {
|
|
|
- options.value = res.groupVOList;
|
|
|
- });
|
|
|
-});
|
|
|
-watchEffect(() => {
|
|
|
- if (props.recipientType) {
|
|
|
- ruleForm.recipientType = props.recipientType;
|
|
|
+ import { onMounted, ref, reactive, watch, watchEffect } from 'vue';
|
|
|
+ import SelectTree from '../persongroup/components/SelectTree.vue';
|
|
|
+ import Group from './Group.vue';
|
|
|
+ import { recipientTypeName } from '../constant';
|
|
|
+ import { ToPushObjectqueryUserGroupList, queryUserGroupDetail } from '../api/index';
|
|
|
+ import type { FormInstance } from 'element-plus';
|
|
|
+ import { GroupData } from '../persongroup/type';
|
|
|
+ const ruleFormRef = ref<FormInstance>();
|
|
|
+ const groupInfo = ref<boolean>(false);
|
|
|
+ const userInfo = ref<boolean>(false);
|
|
|
+ const disabled = ref<boolean>(false);
|
|
|
+ export interface customUserList {
|
|
|
+ userId: number;
|
|
|
+ userLoginName: string;
|
|
|
+ userNickname: string;
|
|
|
+ userNumber: string;
|
|
|
+ }
|
|
|
+ export interface userGroupVOList {
|
|
|
+ userGroupId: number;
|
|
|
+ total: number;
|
|
|
+ operatorName: string;
|
|
|
+ operationTime: string;
|
|
|
+ name: string;
|
|
|
+ description: string;
|
|
|
}
|
|
|
- if (props.userGroupList) {
|
|
|
- ruleForm.userGroupList = props.userGroupList.map((item) => item.userGroupId);
|
|
|
+ interface UserList {
|
|
|
+ id: string;
|
|
|
+ name: string;
|
|
|
+ userId: number;
|
|
|
}
|
|
|
- if (props.customUserList) {
|
|
|
- ruleForm.customUserList = formatCustomUserList(props.customUserList);
|
|
|
- selectedUser.value = formatCustomUserList(props.customUserList);
|
|
|
+ const selectedUser = ref<UserList[]>([]);
|
|
|
+ interface RuleForm {
|
|
|
+ recipientType?: number;
|
|
|
+ userGroupList: number[];
|
|
|
+ customUserList: UserList[];
|
|
|
}
|
|
|
- if (props.disabled) {
|
|
|
- disabled.value = props.disabled;
|
|
|
+ const ruleForm = reactive<RuleForm>({
|
|
|
+ userGroupList: [],
|
|
|
+ customUserList: [],
|
|
|
+ });
|
|
|
+ const props = defineProps<{
|
|
|
+ recipientType?: number;
|
|
|
+ userGroupList?: userGroupVOList[];
|
|
|
+ customUserList?: customUserList[];
|
|
|
+ disabled?: boolean;
|
|
|
+ }>();
|
|
|
+ interface Options {
|
|
|
+ userGroupId?: number;
|
|
|
+ name?: string;
|
|
|
+ description: string;
|
|
|
+ total: number;
|
|
|
+ operatorName: string;
|
|
|
+ operationTime: string;
|
|
|
}
|
|
|
-});
|
|
|
-watch(
|
|
|
- () => ruleForm.customUserList,
|
|
|
- (newSelected) => {
|
|
|
- selectedUser.value = newSelected;
|
|
|
- },
|
|
|
- { immediate: true },
|
|
|
-);
|
|
|
+ const options = ref<Options[]>([]);
|
|
|
+ const userGroupInfo = ref<GroupData[]>();
|
|
|
+ const queryGroupInfo = (groupList) => {
|
|
|
+ groupInfo.value = true;
|
|
|
+ queryUserGroupDetail(groupList).then((res) => {
|
|
|
+ userGroupInfo.value = res.map((group) => ({
|
|
|
+ ...group,
|
|
|
+ isExpand: false,
|
|
|
+ isHidden: false,
|
|
|
+ }));
|
|
|
+ });
|
|
|
+ };
|
|
|
+ const submitForm = () => {
|
|
|
+ return ruleFormRef.value!.validate(() => {});
|
|
|
+ };
|
|
|
+ const getChildValue = () => {
|
|
|
+ return {
|
|
|
+ recipientType: ruleForm.recipientType,
|
|
|
+ userGroupList:
|
|
|
+ ruleForm.recipientType === 3
|
|
|
+ ? []
|
|
|
+ : ruleForm.recipientType === 1
|
|
|
+ ? []
|
|
|
+ : ruleForm.userGroupList.map((item) => item),
|
|
|
+ customUserList:
|
|
|
+ ruleForm.recipientType === 2
|
|
|
+ ? []
|
|
|
+ : ruleForm.recipientType === 1
|
|
|
+ ? []
|
|
|
+ : ruleForm.customUserList.map((item) => item.userId),
|
|
|
+ };
|
|
|
+ };
|
|
|
+ const handleCancle = () => {
|
|
|
+ userInfo.value = false;
|
|
|
+ };
|
|
|
+ const handleSubmit = (selectedData: UserList[]) => {
|
|
|
+ selectedUser.value = selectedData;
|
|
|
+ ruleForm.customUserList = selectedUser.value;
|
|
|
+ userInfo.value = false;
|
|
|
+ };
|
|
|
+ const formatCustomUserList = (customList: customUserList[]): UserList[] => {
|
|
|
+ return customList.map((item) => ({
|
|
|
+ id: `u${item.userId}`,
|
|
|
+ userId: item.userId,
|
|
|
+ name: `${item.userLoginName}-${item.userNickname}`,
|
|
|
+ }));
|
|
|
+ };
|
|
|
+ defineExpose({
|
|
|
+ submitForm,
|
|
|
+ getChildValue,
|
|
|
+ });
|
|
|
+ onMounted(() => {
|
|
|
+ ToPushObjectqueryUserGroupList().then((res) => {
|
|
|
+ options.value = res.groupVOList;
|
|
|
+ });
|
|
|
+ });
|
|
|
+ watchEffect(() => {
|
|
|
+ if (props.recipientType) {
|
|
|
+ ruleForm.recipientType = props.recipientType;
|
|
|
+ }
|
|
|
+ if (props.userGroupList) {
|
|
|
+ ruleForm.userGroupList = props.userGroupList.map((item) => item.userGroupId);
|
|
|
+ }
|
|
|
+ if (props.customUserList) {
|
|
|
+ ruleForm.customUserList = formatCustomUserList(props.customUserList);
|
|
|
+ selectedUser.value = formatCustomUserList(props.customUserList);
|
|
|
+ }
|
|
|
+ if (props.disabled) {
|
|
|
+ disabled.value = props.disabled;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ watch(
|
|
|
+ () => ruleForm.customUserList,
|
|
|
+ (newSelected) => {
|
|
|
+ selectedUser.value = newSelected;
|
|
|
+ },
|
|
|
+ { immediate: true },
|
|
|
+ );
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
-.userGroupList {
|
|
|
- margin-left: 12%;
|
|
|
- width: 88%;
|
|
|
- max-height: 120px;
|
|
|
- padding: 12px 17px 12px 12px;
|
|
|
- background: #fafafa;
|
|
|
- border-radius: 4px;
|
|
|
- :deep(.el-form-item) {
|
|
|
- margin-bottom: 12px !important;
|
|
|
- }
|
|
|
- ::v-deep .el-select__selection {
|
|
|
- min-height: 25px;
|
|
|
- max-height: 60px;
|
|
|
- overflow-y: auto;
|
|
|
- }
|
|
|
- span {
|
|
|
- cursor: pointer;
|
|
|
- margin-left: 80px;
|
|
|
- font-weight: 400;
|
|
|
- font-size: 10px;
|
|
|
- color: #1777ff;
|
|
|
- line-height: 14px;
|
|
|
- }
|
|
|
-}
|
|
|
-.customUserList {
|
|
|
- margin-left: 12%;
|
|
|
- width: 88%;
|
|
|
- max-height: 120px;
|
|
|
- padding: 12px 17px 12px 12px;
|
|
|
- background: #fafafa;
|
|
|
- border-radius: 4px;
|
|
|
- :deep(.el-form-item) {
|
|
|
- margin-bottom: 12px !important;
|
|
|
+ .userGroupList {
|
|
|
+ margin-left: 12%;
|
|
|
+ width: 88%;
|
|
|
+ max-height: 120px;
|
|
|
+ padding: 12px 17px 12px 12px;
|
|
|
+ background: #fafafa;
|
|
|
+ border-radius: 4px;
|
|
|
+ :deep(.el-form-item) {
|
|
|
+ margin-bottom: 12px !important;
|
|
|
+ }
|
|
|
+ ::v-deep .el-select__selection {
|
|
|
+ min-height: 25px;
|
|
|
+ max-height: 60px;
|
|
|
+ overflow-y: auto;
|
|
|
+ }
|
|
|
+ span {
|
|
|
+ cursor: pointer;
|
|
|
+ margin-left: 80px;
|
|
|
+ font-weight: 400;
|
|
|
+ font-size: 10px;
|
|
|
+ color: #1777ff;
|
|
|
+ line-height: 14px;
|
|
|
+ }
|
|
|
}
|
|
|
- ::v-deep .el-select__selection {
|
|
|
- min-height: 25px;
|
|
|
- max-height: 60px;
|
|
|
- overflow-y: auto;
|
|
|
+ .customUserList {
|
|
|
+ margin-left: 12%;
|
|
|
+ width: 88%;
|
|
|
+ max-height: 120px;
|
|
|
+ padding: 12px 17px 12px 12px;
|
|
|
+ background: #fafafa;
|
|
|
+ border-radius: 4px;
|
|
|
+ :deep(.el-form-item) {
|
|
|
+ margin-bottom: 12px !important;
|
|
|
+ }
|
|
|
+ ::v-deep .el-select__selection {
|
|
|
+ min-height: 25px;
|
|
|
+ max-height: 60px;
|
|
|
+ overflow-y: auto;
|
|
|
+ }
|
|
|
}
|
|
|
-}
|
|
|
-</style>
|
|
|
+</style>
|