Commit 57ead639 by linjinhong

修改转换时间显示方式

parent 525078da
...@@ -65,6 +65,7 @@ declare module 'vue' { ...@@ -65,6 +65,7 @@ declare module 'vue' {
RouterView: typeof import('vue-router')['RouterView'] RouterView: typeof import('vue-router')['RouterView']
Select: typeof import('./src/components/Form/Select.vue')['default'] Select: typeof import('./src/components/Form/Select.vue')['default']
ShipmentOrderDetail: typeof import('./src/components/ShipmentOrderDetail.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'] SplitDiv: typeof import('./src/components/splitDiv/splitDiv.vue')['default']
'Switch ': typeof import('./src/components/Form/Switch .vue')['default'] 'Switch ': typeof import('./src/components/Form/Switch .vue')['default']
TableView: typeof import('./src/components/TableView.vue')['default'] TableView: typeof import('./src/components/TableView.vue')['default']
......
...@@ -641,7 +641,9 @@ const getOrderByIdApi = async (type: string) => { ...@@ -641,7 +641,9 @@ const getOrderByIdApi = async (type: string) => {
} }
const tempChinaLogs = ref<LogListData[]>([]) const tempChinaLogs = ref<LogListData[]>([])
const zoneType = ref<string>('Asia/Shanghai')
function changeChinaTime(zone: string) { function changeChinaTime(zone: string) {
zoneType.value = zone
logList.value = tempChinaLogs.value.map((el) => { logList.value = tempChinaLogs.value.map((el) => {
return { return {
...el, ...el,
...@@ -1033,24 +1035,28 @@ onMounted(() => { ...@@ -1033,24 +1035,28 @@ onMounted(() => {
<el-tab-pane label="操作日志" @tab-click="operationLog"> <el-tab-pane label="操作日志" @tab-click="operationLog">
<div> <div>
<el-button <el-button
type="primary" :type="zoneType === 'Asia/Shanghai' ? 'primary' : ''"
size="small" size="small"
link
style="margin-left: 10px"
@click="changeChinaTime('Asia/Shanghai')" @click="changeChinaTime('Asia/Shanghai')"
>转换为中国时间</el-button >北京时间</el-button
> >
<el-button <el-button
type="primary" :type="zoneType === 'America/New_York' ? 'primary' : ''"
size="small" size="small"
link
style="margin-left: 10px" style="margin-left: 10px"
@click="changeChinaTime('America/New_York')" @click="changeChinaTime('America/New_York')"
>转换为新泽西时间</el-button >新泽西时间</el-button
> >
<el-button <el-button
type="primary" :type="zoneType === 'America/Los_Angeles' ? 'primary' : ''"
size="small" size="small"
link
style="margin-left: 10px" style="margin-left: 10px"
@click="changeChinaTime('America/Los_Angeles')" @click="changeChinaTime('America/Los_Angeles')"
>转换为洛杉矶时间</el-button >洛杉矶时间</el-button
> >
</div> </div>
......
...@@ -1975,27 +1975,32 @@ ...@@ -1975,27 +1975,32 @@
<template #header="{ titleId, titleClass }"> <template #header="{ titleId, titleClass }">
<div style="display: flex" class="my-header"> <div style="display: flex" class="my-header">
<div :id="titleId" :class="titleClass">操作日志</div> <div :id="titleId" :class="titleClass">操作日志</div>
<!-- <el-button <div style="margin-left: 15px">
type="primary" <el-button
size="small" :type="timeType === 'Asia/Shanghai' ? 'primary' : ''"
style="margin-left: 10px" size="small"
@click="changeChinaTime" link
>转换为中国时间</el-button style="margin-left: 10px"
> --> @click="changeChinaTime('Asia/Shanghai')"
<el-button >北京时间</el-button
type="primary" >
size="small" <el-button
style="margin-left: 10px" :type="timeType === 'America/New_York' ? 'primary' : ''"
@click="changeChinaTime('America/New_York')" size="small"
>转换为新泽西时间</el-button link
> style="margin-left: 10px"
<el-button @click="changeChinaTime('America/New_York')"
type="primary" >新泽西时间</el-button
size="small" >
style="margin-left: 10px" <el-button
@click="changeChinaTime('America/Los_Angeles')" :type="timeType === 'America/Los_Angeles' ? 'primary' : ''"
>转换为洛杉矶时间</el-button size="small"
> link
style="margin-left: 10px"
@click="changeChinaTime('America/Los_Angeles')"
>洛杉矶时间</el-button
>
</div>
</div> </div>
</template> </template>
<LogList :log-list="logList" /> <LogList :log-list="logList" />
...@@ -4960,12 +4965,14 @@ const completeDelivery = async () => { ...@@ -4960,12 +4965,14 @@ const completeDelivery = async () => {
} }
const tempChinaLogs = ref<LogListData[]>([]) const tempChinaLogs = ref<LogListData[]>([])
const timeType = ref<string>('Asia/Shanghai')
function changeChinaTime(zone: string) { function changeChinaTime(zone: string) {
timeType.value = zone
logList.value = tempChinaLogs.value.map((el) => { logList.value = tempChinaLogs.value.map((el) => {
return { return {
...el, ...el,
createTime: convertToChinaTime(el.createTime, 'Asia/Shanghai', zone), 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