CN-936 开发appearance页面:调整保存按钮位置;修改时区列表获取接口;

This commit is contained in:
hyx
2023-03-21 17:10:37 +08:00
parent ef70c1ac23
commit a8c8a8b6dc
3 changed files with 31 additions and 26 deletions

View File

@@ -1,5 +1,5 @@
.appearance{
height: calc(100% - 100px);
height: 100%;
display:flex;
flex-direction:column;
.appearance-form {
@@ -10,7 +10,6 @@
display: flex;
flex-direction: column;
height: 100%;
//width: 600px;
.el-input {
width:600px;
}
@@ -23,10 +22,10 @@
.edit-appearance-base__footer {
display: flex;
align-items: center;
justify-content: center;
justify-content: start;
height: 100px;
margin-top: 3px;
box-shadow: 0 -1px 4px 0 rgba(0,0,0,0.10);
padding-left:200px;
.footer__btn {
margin: 0 10px;

View File

@@ -20,6 +20,7 @@ export const api = {
login: '/sys/login',
// user
user: '/sys/user',
timezone:'/sys/timezones',
// 获取配置
config: '/sys/config',
// role

View File

@@ -38,16 +38,15 @@
popper-class="right-box-select-dropdown right-box-select-report "
size="small">
<template v-for="timezone in timezoneList" :key="timezone.id">
<el-option :label="timezone.value" :value="timezone.value">
<span style="float: left">{{ timezone.value }}</span>
<span style="float: right;">{{ timezone.remark}}</span>
<el-option :label="timezone.name" :value="timezone.name">
<span style="float: left">{{ timezone.name }}</span>
<span style="float: right;">{{ timezone.offset}}</span>
</el-option>
</template>
</el-select>
</el-form-item>
</el-form>
</div>
<div class="edit-appearance-base__footer">
<button style="position: relative;" :class="{'footer__btn--disabled': blockOperation.save}" :disabled="blockOperation.save" class="footer__btn" @click="save">
<loading size="small" :loading="blockOperation.save"></loading>
@@ -55,6 +54,7 @@
</button>
</div>
</div>
</div>
</template>
<script>
import { api,getDictList } from '@/utils/api'
@@ -115,16 +115,21 @@
this.dateFormatList.forEach(date => {
date.example = window.$dayJs(new Date()).tz().format(date.value)
})
this.timezoneList = await getDictList({ type: 'timezoneList',pageSize: -1 })
await get(api.timezone).then(response => {
if (response.code === 200) {
this.timezoneList = response.data
}
})
if (this.timezoneList && this.timezoneList.length > 0) {
this.timezoneList.forEach(mapData => {
let remark = Number(mapData.remark)/3600000 //转换为小
mapData.timezoneOffset = remark
let hour = Math.abs(parseInt(remark))
let remarkStr = remark.toString()
let offset = Number(mapData.offset)/3600000 //转换为小
mapData.timezoneOffset = offset
let hour = Math.abs(parseInt(offset))
let offsetStr = offset.toString()
let minute = 0
if(remarkStr.indexOf('.') > -1){
minute = Math.abs(Number(remarkStr.substring(remarkStr.indexOf('.')))*60)
if(offsetStr.indexOf('.') > -1){
minute = Math.abs(Number(offsetStr.substring(offsetStr.indexOf('.')))*60)
}
let str = ''
if(hour<10){
@@ -138,12 +143,12 @@
}else {
str += minute
}
if(remark > 0){
mapData.remark = 'UTC+'+str
}else if(remark === 0){
mapData.remark = 'UTC'
if(offset > 0){
mapData.offset = 'UTC+'+str
}else if(offset === 0){
mapData.offset = 'UTC'
}else {
mapData.remark = 'UTC-'+str
mapData.offset = 'UTC-'+str
}
})
}
@@ -177,7 +182,7 @@
if (this.appearanceObject.timezone !== localStorage.getItem(storageKey.sysTimezone)) {
localStorage.setItem(storageKey.sysTimezone, this.appearanceObject.timezone)
}
let timezone = this.timezoneList.find(mapData => mapData.value === this.appearanceObject.timezone)
let timezone = this.timezoneList.find(mapData => mapData.name === this.appearanceObject.timezone)
if (timezone.timezoneOffset !== localStorage.getItem(storageKey.timezoneOffset)) {
localStorage.setItem(storageKey.timezoneOffset, timezone.timezoneOffset)
}