fix:修改时间选择器 未国际化 以及 判断条件错误的问题

This commit is contained in:
zhangyu
2022-05-07 14:28:21 +08:00
parent ace231cf02
commit 9079b6ecc3
6 changed files with 95 additions and 58 deletions

View File

@@ -12,6 +12,12 @@ const webpack = require('webpack')
const config = require('../config')
const webpackConfig = require('./webpack.prod.conf')
const spinner = ora('building for production...')
console.log(config, webpackConfig)
if (webpackConfig.entry.exportHtml) {
config.build.index = path.resolve(__dirname, '../exportHtml/index.html')
config.build.assetsRoot = path.resolve(__dirname, '../exportHtml')
}
console.log(config, webpackConfig.entry.exportHtml)
spinner.start()
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {

View File

@@ -336,56 +336,46 @@ if (process.env.NODE_ENV == 'development') {
})
)
} else {
webpackConfig.plugins.push(
new fileManagerPlugin({
onStart: [
{
delete: [path.join(__dirname, '../dist/')]
}
],
onEnd: [
{
move: [
{ source: path.join(__dirname, '../dist', '/static/config.json'), destination: path.join(__dirname, '../dist/config.json') }
const plugin = {
onStart: [
{
delete: [path.join(__dirname, '../dist/')]
}
],
onEnd: [
{
move: [
{ source: path.join(__dirname, '../dist', '/static/config.json'), destination: path.join(__dirname, '../dist/config.json') }
],
mkdir: [
path.join(__dirname, '../dist', '/static')
],
copy: [
{ source: path.join(__dirname, '../dist', '/config.json'), destination: path.join(__dirname, '../dist', '/static/config.json') }
]
},
{
delete: [
path.join(__dirname, '../dist', '/config.json'),
path.join(__dirname, '../.cache/')
]
},
{
archive: [
{ source: path.join(__dirname, '../dist'), destination: path.join(__dirname, '../dist', '/nz-gui.zip') }
]
}
]
})
// new WebpackZipPlugin({
// initialFile: './dist',
// endPath: './dist',
// zipName: 'nz-gui.zip'
// // behindShell: 'cd ' + path.join(__dirname, '../dist/') + ";md5=`md5sum nz-gui.zip |awk '{print $1}'|cut -c 1-8`;mv nz-gui.zip nz-gui-${md5}.zip;" + (process.env.BUILD_MODE == 'all' ? 'mkdir -p ./dist/static;echo "start add map picture to zip file,it will take a few moment,please wait...";cp -r ../static/Tiles dist/static/;zip -gr nz-gui-${md5}.zip dist/static/Tiles>/dev/null;rm -rf dist;' : '')
// })
// new WebpackShellPlugin({
// onBuildStart: ['/bin/bash ' + path.join(__dirname, 'script') + '/buildStart.sh'],
// onBuildEnd: ['/bin/bash ' + path.join(__dirname, 'script') + '/buildEnd.sh ' + process.env.BUILD_MODE]
// })
// new fileManagerPlugin({
// onStart: [
// {
// delete: [path.join(__dirname, '../dist/')]
// }
// ]
// })
],
mkdir: [
path.join(__dirname, '../dist', '/static')
],
copy: [
{ source: path.join(__dirname, '../dist', '/config.json'), destination: path.join(__dirname, '../dist', '/static/config.json') }
]
},
{
delete: [
path.join(__dirname, '../dist', '/config.json'),
path.join(__dirname, '../.cache/')
]
},
{
archive: [
{ source: path.join(__dirname, '../dist'), destination: path.join(__dirname, '../dist', '/nz-gui.zip') }
]
}
]
}
if (arg === 'html') {
plugin.onStart[0].delete.push(path.join(__dirname, '../exportHtml/'))
plugin.onEnd[0].copy.push(
{ source: path.join(__dirname, '../dist', '/index.html'), destination: path.join(__dirname, '../exportHtml', '/index.html') }
)
}
webpackConfig.plugins.push(
new fileManagerPlugin(plugin)
)
}

View File

@@ -394,7 +394,6 @@ export default {
default: true
},
isOnly: {
type: Boolean,
default: false
}
},
@@ -448,9 +447,6 @@ export default {
if (!valueEquals(val, oldVal) && !this.pickerVisible && this.validateEvent) {
this.dispatch('ElFormItem', 'el.form.change', val)
}
},
isOnly:{
immediate: true
}
},

View File

@@ -381,8 +381,8 @@ export default {
this.oldSearchTime[1] = bus.timeFormate(this.oldSearchTime[1])
}
}
console.log(moment(this.oldSearchTime[0], this.timeFormatMain).isValid(), moment(this.oldSearchTime[1], this.timeFormatMain).isValid(), !moment(this.oldSearchTimeError[0]).isBefore(this.oldSearchTime[1]))
if (moment(this.oldSearchTime[0], this.timeFormatMain).isValid() && moment(this.oldSearchTime[1], this.timeFormatMain).isValid() && !moment(this.oldSearchTimeError[0]).isBefore(this.oldSearchTime[1])) {
console.log(moment(this.oldSearchTime[0], this.timeFormatMain).isValid(), moment(this.oldSearchTime[1], this.timeFormatMain).isValid(), !moment(this.oldSearchTime[0]).isBefore(this.oldSearchTime[1]))
if (moment(this.oldSearchTime[0], this.timeFormatMain).isValid() && moment(this.oldSearchTime[1], this.timeFormatMain).isValid() && !moment(this.oldSearchTime[0]).isBefore(this.oldSearchTime[1])) {
this.oldSearchTimeError[0] = true
this.inputError = this.$t('date.fromGreaterTo')
}

View File

@@ -44,10 +44,51 @@ import { loadI18n } from '@/components/common/i18n'
import i18nData from '@/entrance/exportHtml/i18nData'
const dataJson = window.dataJson || {
panel: { id: 1487, name: 'Overview', createBy: 1, type: 'dashboard', link: 0, pid: 0, weight: 0, buildIn: 1, seq: 'v3.2-buildin', children: [], parent: null, chartNum: 18 },
language: 'en',
language: 'zh',
start: 1651833659000,
end: 1651833659000,
charts: { msg: 'success', code: 200, data: { total: 1, pageSize: -1, pages: 1, pageNo: 1, list: [{ id: 10341, name: 'Last Slave', panelId: 675, groupId: 0, span: 4.0, height: 4.0, updateBy: 106, updateAt: '2022-04-26 01:53:21', type: 'line', unit: 30, weight: 0, param: { stack: 0, thresholds: [{ color: '#06a041' }], thresholdShow: true, legend: { values: [], show: true, placement: 'bottom' }, enable: { thresholds: false, legend: true, valueMapping: false }, link: '', valueMapping: [], nullType: 'null' }, pid: null, buildIn: 0, remark: '', seq: null, x: 0.0, y: 12.0, elements: [{ id: 16051, chartId: 10341, expression: 'redis_rdb_last_save_timestamp_seconds', type: 'expert', legend: '', buildIn: 0, seq: null, name: 'A', state: 1 }], sync: null, panel: { id: 675, name: 'NZ Mariadb', createBy: null, type: null, link: null, pid: null, weight: null, buildIn: null, seq: null, children: null, parent: null, chartNum: null }, group: { id: 0, name: null, panelId: null, groupId: null, span: null, height: null, updateBy: null, updateAt: null, type: null, unit: null, weight: null, param: null, pid: null, buildIn: null, remark: null, seq: null, x: null, y: null, elements: null, sync: null, panel: null, group: null, children: null, chartNums: null, asset: null, varType: null, varId: null, varName: null, datasource: null }, children: null, chartNums: null, asset: null, varType: null, varId: null, varName: null, datasource: 'metrics' }] }, time: '2022-05-05 07:26:03' },
charts: {
msg: 'success',
code: 200,
data: {
total: 1,
pageSize: -1,
pages: 1,
pageNo: 1,
list: [{
id: 10341,
name: 'Last Slave',
panelId: 675,
groupId: 0,
span: 4.0,
height: 4.0,
updateBy: 106,
updateAt: '2022-04-26 01:53:21',
type: 'line',
unit: 2,
weight: 0,
param: { stack: 0, thresholds: [{ color: '#06a041' }], thresholdShow: true, legend: { values: ['range','last'], show: true, placement: 'bottom' }, enable: { thresholds: false, legend: true, valueMapping: false }, link: '', valueMapping: [], nullType: 'null' },
pid: null,
buildIn: 0,
remark: '',
seq: null,
x: 0.0,
y: 12.0,
elements: [{ id: 16051, chartId: 10341, expression: 'redis_rdb_last_save_timestamp_seconds', type: 'expert', legend: '', buildIn: 0, seq: null, name: 'A', state: 1 }],
sync: null,
panel: { id: 675, name: 'NZ Mariadb', createBy: null, type: null, link: null, pid: null, weight: null, buildIn: null, seq: null, children: null, parent: null, chartNum: null },
group: { id: 0, name: null, panelId: null, groupId: null, span: null, height: null, updateBy: null, updateAt: null, type: null, unit: null, weight: null, param: null, pid: null, buildIn: null, remark: null, seq: null, x: null, y: null, elements: null, sync: null, panel: null, group: null, children: null, chartNums: null, asset: null, varType: null, varId: null, varName: null, datasource: null },
children: null,
chartNums: null,
asset: null,
varType: null,
varId: null,
varName: null,
datasource: 'metrics'
}]
},
time: '2022-05-05 07:26:03'
},
chartsData: {
'10341_0': { data: { result: [{ metric: { endpoint: '7400-192.168.40.165-MCN0-MAAT', module_id: '293', nz_agent_id: '75', __name__: 'redis_rdb_last_save_timestamp_seconds', project_id: '25', module: 'MCN0-MAAT', endpoint_id: '253', project: '7400', datacenter: 'xin_xi_gang_DC', asset_id: '29', asset: '7400-192.168.40.165', datacenter_id: '4' }, values: [[1651735328, '1651735257'], [1651735343, '1651735257'], [1651735358, '1651735257'], [1651735373, '1651735257'], [1651735388, '1651735257'], [1651735403, '1651735257'], [1651735418, '1651735257'], [1651735433, '1651735257'], [1651735448, '1651735257'], [1651735463, '1651735257'], [1651735478, '1651735257'], [1651735493, '1651735257'], [1651735508, '1651735257'], [1651735523, '1651735257'], [1651735538, '1651735257'], [1651735553, '1651735257'], [1651735568, '1651735257'], [1651735583, '1651735257'], [1651735598, '1651735257'], [1651735613, '1651735257'], [1651735628, '1651735257']] }, { metric: { endpoint: 'CM-Sync-Redis-Bifang-CM-Server', module_id: '173', nz_agent_id: '73', __name__: 'redis_rdb_last_save_timestamp_seconds', project_id: '19', module: 'CM-Sync-Redis', endpoint_id: '433', project: 'Bifang-CM', datacenter: 'xin_xi_gang_DC', asset_id: '127', asset: 'Bifang-CM-Server', datacenter_id: '4' }, values: [[1651735328, '1651735396'], [1651735343, '1651735396'], [1651735358, '1651735396'], [1651735373, '1651735396'], [1651735388, '1651735396'], [1651735403, '1651735396'], [1651735418, '1651735396'], [1651735433, '1651735396'], [1651735448, '1651735396'], [1651735463, '1651735396'], [1651735478, '1651735396'], [1651735493, '1651735396'], [1651735508, '1651735396'], [1651735523, '1651735396'], [1651735538, '1651735396'], [1651735553, '1651735396'], [1651735568, '1651735396'], [1651735583, '1651735396'], [1651735598, '1651735396'], [1651735613, '1651735396'], [1651735628, '1651735396']] }, { metric: { endpoint: 'CM-Sync-Redis-Bifang-CM-Server1', module_id: '173', nz_agent_id: '75', __name__: 'redis_rdb_last_save_timestamp_seconds', project_id: '19', module: 'CM-Sync-Redis', endpoint_id: '435', project: 'Bifang-CM', datacenter: 'xin_xi_gang_DC', asset_id: '129', asset: 'Bifang-CM-Server1', datacenter_id: '4' }, values: [[1651735328, '1651735396'], [1651735343, '1651735396'], [1651735358, '1651735396'], [1651735373, '1651735396'], [1651735388, '1651735396'], [1651735403, '1651735396'], [1651735418, '1651735396'], [1651735433, '1651735396'], [1651735448, '1651735396'], [1651735463, '1651735396'], [1651735478, '1651735396'], [1651735493, '1651735396'], [1651735508, '1651735396'], [1651735523, '1651735396'], [1651735538, '1651735396'], [1651735553, '1651735396'], [1651735568, '1651735396'], [1651735583, '1651735396'], [1651735598, '1651735396'], [1651735613, '1651735396'], [1651735628, '1651735396']] }, { metric: { endpoint: 'CM-Redis-192.168.44.18', module_id: '173', nz_agent_id: '75', __name__: 'redis_rdb_last_save_timestamp_seconds', project_id: '19', module: 'CM-Sync-Redis', endpoint_id: '57', project: 'Bifang-CM', datacenter: 'xin_xi_gang_DC', asset_id: '11', asset: 'Bifang-CM-Server2', datacenter_id: '4' }, values: [[1651735328, '1651735371'], [1651735343, '1651735371'], [1651735358, '1651735371'], [1651735373, '1651735371'], [1651735388, '1651735371'], [1651735403, '1651735371'], [1651735418, '1651735371'], [1651735433, '1651735371'], [1651735448, '1651735371'], [1651735463, '1651735371'], [1651735478, '1651735371'], [1651735493, '1651735371'], [1651735508, '1651735371'], [1651735523, '1651735371'], [1651735538, '1651735371'], [1651735553, '1651735371'], [1651735568, '1651735371'], [1651735583, '1651735371'], [1651735598, '1651735371'], [1651735613, '1651735371'], [1651735628, '1651735371']] }], resultType: 'matrix' }, status: 'success' },
'1_1': { data: { result: [], resultType: 'matrix' }, status: 'success' },
@@ -67,8 +108,12 @@ export default {
chartList: chartList
},
created () {
this.$i18n.locale = this.dataJson.language
console.log(this.$i18n.locale, this.dataJson.language)
loadI18n(i18nData)
},
mounted () {
},
methods: {
editChart () {},
refreshTime () {},

File diff suppressed because one or more lines are too long