TrackHistory.vue
3.47 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
<template>
<template>
<BasicDrawer
@register="register"
v-bind="$attrs"
title="操作记录"
width="40%"
:isDetail="true"
:showDetailBack="false"
okText="保存"
:destroyOnClose="true"
>
<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>
<div>TRACKER</div>
<span>{{ item.opinionType }}</span>
</template>
<template #description>
<div class="description">
{{ item.showOpinionType }}
</div>
<div class="info">
<div>操作时间:{{ item.modifyTime }}</div>
</div>
</template>
</a-list-item-meta>
</a-list-item>
</template>
</a-list>
<!-- <template #titleToolbar> <a-button type="primary"> 申请编辑权限 </a-button></template> -->
<template #appendFooter>
<!-- <a-button type="primary" @click="onGoCheckDetail"> 申请权限</a-button> -->
</template>
</BasicDrawer>
</template>
</template>
<script lang="ts" setup>
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 { trackHistory, getOrderOptLog } from '/@/api/project/order';
import { formatToDateTime } from '/@/utils/dateUtil';
const list1 = ref([]);
const total1 = ref(0);
const page1 = ref(1);
const orderId = ref('');
// const activeKey = ref(1);
function removeTFromTimestamp(timestamp: string): string {
// 使用 replace 方法将 "T" 替换为空字符串
return timestamp.replace('T', ' ');
}
const getOrderOptLogFunc = async (data, page) => {
console.log('%c [ data ]-135', 'font-size:13px; background:pink; color:#bf2c9f;', data);
const res = await trackHistory({ orderId: data, page: page, pageSize: 20 });
list1.value = res;
for (const item of list1.value) {
item.modifyTime = removeTFromTimestamp(item.modifyTime);
item.showOpinionType = modifyConfirmResult(item.field, item.modifyTime);
}
};
const [register] = useDrawerInner((data) => {
orderId.value = data.id;
// const res = await trackHistory({ orderId: data, page: page, pageSize: 20 });
getOrderOptLogFunc(orderId.value, 1);
});
function modifyConfirmResult(Result: string, Time: string): string {
// 获取 Time 的日期部分,去掉时间
let datePart = Time.split(' ')[0]; // 获取日期部分
datePart += ' ';
// 找到第一个"."的位置
const dotIndex = Result.indexOf('.');
// 如果找到了".",则进行拼接
if (dotIndex !== -1) {
// 生成新的结果
const modifiedResult = `${Result.slice(0, dotIndex + 1)}${datePart}${Result.slice(
dotIndex + 1,
)}`;
return modifiedResult;
}
// 如果没有找到".",直接返回原始字符串
return Result;
}
const pagination1 = computed(() => {
return {
show: true,
pageSize: 20,
page: page1.value,
total: total1.value,
onChange(cur) {
console.log(cur);
getOrderOptLogFunc(orderId.value, 1, cur);
},
};
});
</script>