fix:修改 asset保存时 时间格式的相关问题以及 group隐藏全屏按钮

This commit is contained in:
zhangyu
2022-01-05 18:01:30 +08:00
parent 59615a0296
commit 94bc57885c
4 changed files with 38 additions and 10 deletions

View File

@@ -46,7 +46,7 @@
<i class="nz-icon nz-icon-replay tool__icon"></i>
</el-tooltip>
</span>
<span v-if="from !== this.$CONSTANTS.fromRoute.chartTemp" class="chart-header__tool" @click="showFullscreen">
<span v-if="from !== this.$CONSTANTS.fromRoute.chartTemp && chartInfo.type!=='group'" class="chart-header__tool" @click="showFullscreen">
<el-tooltip :content="$t('dashboard.screen')" effect="light" placement="top">
<i class="nz-icon nz-icon-maxview tool__icon"></i>
</el-tooltip>

View File

@@ -74,7 +74,6 @@
popper-class="right-box-select-top"
style="width: 100%"
type="date"
:value-format="timeFormatStrToDatePickFormat(timeFormatMain, 1)"
:format="timeFormatStrToDatePickFormat(timeFormatMain, 1)">
</my-date-picker>
</el-form-item>
@@ -139,13 +138,12 @@
<template v-if="JSON.parse(label.param).interval">
<my-date-picker
id="asset-box-input-purchase-date"
v-model="label.value[0]"
:type="JSON.parse(label.param).subType === assetConstants.labelSubTypeData.date ? 'dateRange' : 'datetimerange'"
v-model="label.value"
:type="JSON.parse(label.param).subType === assetConstants.labelSubTypeData.date ? 'daterange' : 'datetimerange'"
placeholder=""
popper-class="right-box-select-top"
size="small"
:value-format="timeFormatStrToDatePickFormat(timeFormatMain)"
:format="timeFormatStrToDatePickFormat(timeFormatMain)"
:format="timeFormatStrToDatePickFormat(timeFormatMain,JSON.parse(label.param).subType === assetConstants.labelSubTypeData.date)"
style="width: 100%">
</my-date-picker>
</template>
@@ -158,8 +156,7 @@
popper-class="right-box-select-top"
size="small"
style="width: 100%"
:value-format="timeFormatStrToDatePickFormat(timeFormatMain)"
:format="timeFormatStrToDatePickFormat(timeFormatMain)">
:format="timeFormatStrToDatePickFormat(timeFormatMain, JSON.parse(label.param).subType === assetConstants.labelSubTypeData.date)">
</my-date-picker>
</template>
</template>
@@ -306,6 +303,7 @@ import { asset as assetConstants } from '@/components/common/js/constants'
import selectAssetType from '@/components/common/popBox/selectAssetType'
import locationCascader from '@/components/common/rightBox/locationCascader'
import editRigthBox from '../../mixin/editRigthBox'
import bus from '@/libs/bus'
export default {
name: 'assetBox',
@@ -667,6 +665,23 @@ export default {
this.$refs.form.validate((valid) => {
if (valid) {
const params = JSON.parse(JSON.stringify(this.editAsset))
console.log(params)
params.fields.forEach(field => {
if (field.type === 'DATETIME') {
const param = JSON.parse(field.param)
if (param.subType === 'date') {
field.value = field.value.map(time => bus.timeFormate(new Date(time), 'YYYY-MM-DD'))
} else if (param.subType === 'datetime') {
field.value = field.value.map(time => bus.timeFormate(new Date(time), 'YYYY-MM-DD HH:mm:ss'))
}
}
})
console.log(params)
if (params.purchaseDate) {
console.log(params.purchaseDate)
params.purchaseDate = bus.timeFormate(new Date(params.purchaseDate), 'YYYY-MM-DD')
console.log(params.purchaseDate)
}
if (params.type.vm !== 1) {
params.parent = {}
params.pid = '-1'

View File

@@ -758,6 +758,19 @@ export default {
this.titleSearchList[key].show = true
this.detailSearchList[key].show = true
})
},
edit (u) {
this.$get(`${this.url}/${u.id}`).then(response => {
if (response.code === 200) {
if (response.data.purchaseDate) {
response.data.purchaseDate += ' 00:00:00'
response.data.purchaseDate = new Date(response.data.purchaseDate)
console.log(response.data.purchaseDate)
}
this.object = response.data
this.rightBox.show = true
}
})
}
},
created () {

View File

@@ -161,8 +161,8 @@ Vue.mixin({
translation (key) {
return i18n.t(key)
},
timeFormatStrToDatePickFormat (str, index) {
if (index === 1) {
timeFormatStrToDatePickFormat (str, flag) {
if (flag) {
const reg = /Y/g
str = str.replace(reg, 'y')
const reg1 = /D/g