Commit 57ead639 by linjinhong

修改转换时间显示方式

parent 525078da
......@@ -65,6 +65,7 @@ declare module 'vue' {
RouterView: typeof import('vue-router')['RouterView']
Select: typeof import('./src/components/Form/Select.vue')['default']
ShipmentOrderDetail: typeof import('./src/components/ShipmentOrderDetail.vue')['default']
SideBar: typeof import('./src/components/SideBar.vue')['default']
SplitDiv: typeof import('./src/components/splitDiv/splitDiv.vue')['default']
'Switch ': typeof import('./src/components/Form/Switch .vue')['default']
TableView: typeof import('./src/components/TableView.vue')['default']
......
......@@ -641,7 +641,9 @@ const getOrderByIdApi = async (type: string) => {
}
const tempChinaLogs = ref<LogListData[]>([])
const zoneType = ref<string>('Asia/Shanghai')
function changeChinaTime(zone: string) {
zoneType.value = zone
logList.value = tempChinaLogs.value.map((el) => {
return {
...el,
......@@ -1033,24 +1035,28 @@ onMounted(() => {
<el-tab-pane label="操作日志" @tab-click="operationLog">
<div>
<el-button
type="primary"
:type="zoneType === 'Asia/Shanghai' ? 'primary' : ''"
size="small"
link
style="margin-left: 10px"
@click="changeChinaTime('Asia/Shanghai')"
>转换为中国时间</el-button
>北京时间</el-button
>
<el-button
type="primary"
:type="zoneType === 'America/New_York' ? 'primary' : ''"
size="small"
link
style="margin-left: 10px"
@click="changeChinaTime('America/New_York')"
>转换为新泽西时间</el-button
>新泽西时间</el-button
>
<el-button
type="primary"
:type="zoneType === 'America/Los_Angeles' ? 'primary' : ''"
size="small"
link
style="margin-left: 10px"
@click="changeChinaTime('America/Los_Angeles')"
>转换为洛杉矶时间</el-button
>洛杉矶时间</el-button
>
</div>
......
......@@ -1975,27 +1975,32 @@
<template #header="{ titleId, titleClass }">
<div style="display: flex" class="my-header">
<div :id="titleId" :class="titleClass">操作日志</div>
<!-- <el-button
type="primary"
size="small"
style="margin-left: 10px"
@click="changeChinaTime"
>转换为中国时间</el-button
> -->
<el-button
type="primary"
size="small"
style="margin-left: 10px"
@click="changeChinaTime('America/New_York')"
>转换为新泽西时间</el-button
>
<el-button
type="primary"
size="small"
style="margin-left: 10px"
@click="changeChinaTime('America/Los_Angeles')"
>转换为洛杉矶时间</el-button
>
<div style="margin-left: 15px">
<el-button
:type="timeType === 'Asia/Shanghai' ? 'primary' : ''"
size="small"
link
style="margin-left: 10px"
@click="changeChinaTime('Asia/Shanghai')"
>北京时间</el-button
>
<el-button
:type="timeType === 'America/New_York' ? 'primary' : ''"
size="small"
link
style="margin-left: 10px"
@click="changeChinaTime('America/New_York')"
>新泽西时间</el-button
>
<el-button
:type="timeType === 'America/Los_Angeles' ? 'primary' : ''"
size="small"
link
style="margin-left: 10px"
@click="changeChinaTime('America/Los_Angeles')"
>洛杉矶时间</el-button
>
</div>
</div>
</template>
<LogList :log-list="logList" />
......@@ -4960,12 +4965,14 @@ const completeDelivery = async () => {
}
const tempChinaLogs = ref<LogListData[]>([])
const timeType = ref<string>('Asia/Shanghai')
function changeChinaTime(zone: string) {
timeType.value = zone
logList.value = tempChinaLogs.value.map((el) => {
return {
...el,
createTime: convertToChinaTime(el.createTime, 'Asia/Shanghai', zone),
local: zone.split('/')[1],
local: zone.split('/')[1] === 'Shanghai' ? 'BeiJing' : zone.split('/')[1],
}
})
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment