wupengfei
2 天以前 f35680f356168af8d4a3d5f34456e561af40fbba
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<template>
  <ProDialog :title="form.title" v-model="visible" destroy-on-close draggable bodyNoPaddingBottom>
    <ProDialogTableWrapper :height="400">
      <ProTableV2 v-bind="proTableProps" :columns="column" :operationBtns="operationBtns">
      </ProTableV2>
    </ProDialogTableWrapper>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="emit('onConfirm')" type="primary">确 定</el-button>
      </span>
    </template>
  </ProDialog>
</template>
 
<script setup lang="ts">
import {
  ProDialog,
  ProTableV2,
  ProDialogTableWrapper,
  useTable,
  defineColumns,
  defineOperationBtns,
} from '@bole-core/components';
import * as advertisementServices from '@/services/api/advertisement';
import { EnumDbAuditOperateText } from '@/constants';
 
defineOptions({
  name: 'LogDialog',
});
 
type Form = {
  title?: string;
  id: string;
};
 
const form = defineModel<Form>('form');
const visible = defineModel<boolean>('modelValue');
 
const emit = defineEmits<{
  (e: 'onCancel'): void;
  (e: 'onConfirm'): void;
}>();
 
const column = defineColumns([
  {
    id: '1',
    enCode: 'createdUser',
    name: '操作人',
  },
  {
    id: '2',
    enCode: 'createdTime',
    name: '操作时间',
  },
  {
    id: '3',
    enCode: 'operate',
    name: '操作',
  },
  {
    id: '4',
    enCode: 'content',
    name: '操作内容',
  },
]);
 
const operationBtns = defineOperationBtns([]);
 
watch(
  () => visible.value,
  (val) => {
    if (val) {
      getList();
    }
  }
);
 
const {
  getDataSource: getList,
  proTableProps,
  paginationState,
  extraParamState,
} = useTable(
  async ({ pageIndex, pageSize }, extraParamState) => {
    try {
      let params: API.GetAdvertisementLogsQuery = {
        pageModel: {
          rows: pageSize,
          page: pageIndex,
          orderInput: extraParamState.orderInput,
        },
        id: form.value?.id,
      };
      let res = await advertisementServices.getAdvertisementLogs(params);
      return res;
    } catch (error) {}
  },
  {
    defaultExtraParams: {
      orderInput: [{ property: 'id', order: EnumPagedListOrder.Desc }],
    },
    columnsRenderProps: {
      createdTime: { type: 'date', format: 'YYYY-MM-DD HH:mm:ss' },
      operate: { type: 'enum', valueEnum: EnumDbAuditOperateText },
    },
  }
);
</script>
 
<style lang="scss" scoped>
@use '@/style/common.scss' as *;
</style>