zhengyiming
4 天以前 8feaba218a5ce22e92214e4c9082faf59b25c885
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import { useDialog } from '@bole-core/components';
import { OperateHistoryTypeEnum } from '@/constants';
 
type UseAdvertisementListOptions = {
  operateType?: MaybeRef<number>;
};
 
export function useOpenLogDialog(options: UseAdvertisementListOptions = {}) {
  const { operateType } = options;
 
  const relationId = ref('');
 
  const { dialogProps, dialogState } = useDialog();
 
  async function openLogDialog(_relationId: string) {
    relationId.value = _relationId;
    await nextTick();
    dialogState.dialogVisible = true;
  }
 
  const logDialogProps = computed(() => {
    return {
      ...dialogProps.value,
      relationId: relationId.value,
      operateType: unref(operateType),
    };
  });
  return {
    logDialogProps,
    openLogDialog,
  };
}
 
type UseOpenLogByTypeDialogOptions = {
  operateHistoryType?: MaybeRef<OperateHistoryTypeEnum>;
};
 
export function useOpenLogByTypeDialog(options: UseOpenLogByTypeDialogOptions = {}) {
  const { operateHistoryType } = options;
 
  const relationId = ref('');
 
  const { dialogProps, dialogState } = useDialog();
 
  async function openLogDialog(_relationId: string) {
    relationId.value = _relationId;
    await nextTick();
    dialogState.dialogVisible = true;
  }
 
  const logDialogProps = computed(() => {
    return {
      ...dialogProps.value,
      relationId: relationId.value,
      operateHistoryType: unref(operateHistoryType),
    };
  });
  return {
    logDialogProps,
    openLogDialog,
  };
}