HistoryDetail.vue
5.25 KB
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<template>
<BasicDrawer
@register="register"
v-bind="$attrs"
title="操作记录"
width="60%"
:isDetail="true"
:showDetailBack="false"
okText="保存"
:destroyOnClose="true"
>
<Tabs v-model:activeKey="activeKey" className="my-0">
<TabPanel :key="1" tab="操作记录" className="w-full">
<a-list :pagination="pagination1" className="w-full">
<template v-for="item in list1" :key="item.id">
<a-list-item class="list">
<a-list-item-meta>
<template #avatar> </template>
<template #title>
<span>{{ item.userName }}</span>
</template>
<template #description>
<div class="description">
{{ item.optType }}
</div>
<div class="info">
<div><span>操作时间:</span>{{ formatToDateTime(item.createTime) }}</div>
</div>
</template>
</a-list-item-meta>
</a-list-item>
</template>
</a-list>
</TabPanel>
<TabPanel :key="2" tab="审批记录" className="w-full">
<a-list :pagination="pagination2" className="w-full">
<template v-for="item in list2" :key="item.id">
<a-list-item class="list">
<a-list-item-meta>
<template #avatar> </template>
<template #title>
<span>{{ item.applyUserName }}</span>
</template>
<template #description>
<div class="description">
{{ item.applyRemark }}
</div>
<div class="info">
<div><span>操作时间:</span>{{ formatToDateTime(item.createTime) }}</div>
</div>
</template>
</a-list-item-meta>
</a-list-item>
</template>
</a-list>
</TabPanel>
</Tabs>
<!-- <template #titleToolbar> <a-button type="primary"> 申请编辑权限 </a-button></template> -->
<template #appendFooter>
<!-- <a-button type="primary" @click="onGoCheckDetail"> 申请权限</a-button> -->
</template>
</BasicDrawer>
</template>
<script lang="ts">
import { defineComponent, ref, computed } from 'vue';
import { Tabs, Progress, Row, Col, List } from 'ant-design-vue';
import { FormSchema, useForm } from '/@/components/Form/index';
import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
import { getOrderAuditLog, getOrderOptLog } from '/@/api/project/order';
import { formatToDateTime } from '/@/utils/dateUtil';
const TabPanel = Tabs.TabPane;
const schemas: FormSchema[] = [
{
field: '订单号',
component: 'Input',
label: '字段1',
componentProps: {
readonly: true,
disabled: true,
},
colProps: {
span: 12,
},
defaultValue: '111',
},
{
field: 'field2',
component: 'Input',
label: '字段2',
colProps: {
span: 12,
},
},
];
const achieveList = [
{
key: '1',
name: '操作记录',
},
{
key: '2',
name: '审批记录',
},
];
export default defineComponent({
components: {
BasicDrawer,
Tabs,
TabPanel,
[List.name]: List,
[List.Item.name]: List.Item,
AListItemMeta: List.Item.Meta,
},
props: {
onGoCheckDetail: {
type: Function,
},
},
setup() {
const list1 = ref([]);
const total1 = ref(0);
const page1 = ref(1);
const list2 = ref([]);
const total2 = ref(0);
const page2 = ref(1);
const orderId = ref('');
const activeKey = ref(1);
const getOrderOptLogFunc = async (data, index, page) => {
if (index === 1) {
const res = await getOrderOptLog({ orderId: data.id, page: page, pageSize: 20 });
list1.value = res.records;
total1.value = res.total;
page1.value = page;
} else {
const res = await getOrderAuditLog({ orderId: data.id, page: page, pageSize: 20 });
list2.value = res.records;
total2.value = res.total;
page2.value = page;
}
};
const [register] = useDrawerInner((data) => {
orderId.value = data.id;
getOrderOptLogFunc(orderId.value, 1, 1);
getOrderOptLogFunc(orderId.value, 2, 1);
});
const pagination1 = computed(() => {
return {
show: true,
pageSize: 20,
page: page1.value,
total: total1.value,
onChange(cur) {
getOrderOptLogFunc(orderId.value, 1, cur);
},
};
});
const pagination2 = computed(() => {
return {
show: true,
pageSize: 20,
page: page1.value,
total: total1.value,
onChange(cur) {
getOrderOptLogFunc(orderId.value, 2, cur);
},
};
});
return {
register,
schemas,
achieveList,
list1,
list2,
prefixCls: 'account-center',
pagination1,
pagination2,
activeKey,
formatToDateTime,
};
},
});
</script>