提交 9721a406 authored 作者: wangjiahao's avatar wangjiahao

Merge remote-tracking branch 'origin/main' into main

<template> <template>
<el-date-picker <el-date-picker
v-if="options!== null && options.attrs!==null" v-if="options!== null && options.attrs!==null"
ref="dateRef"
v-model="options.value" v-model="options.value"
:type="options.attrs.type" :type="options.attrs.type"
:range-separator="options.attrs.rangeSeparator" :range-separator="options.attrs.rangeSeparator"
...@@ -12,6 +13,7 @@ ...@@ -12,6 +13,7 @@
</template> </template>
<script> <script>
import { dateFormat } from '@/utils'
export default { export default {
props: { props: {
...@@ -44,10 +46,41 @@ export default { ...@@ -44,10 +46,41 @@ export default {
value: Array.isArray(this.options.value) ? this.options.value : [this.options.value], value: Array.isArray(this.options.value) ? this.options.value : [this.options.value],
operator: this.operator operator: this.operator
} }
param.value = this.formatValues(param.value)
this.inDraw && this.$store.dispatch('conditions/add', param) this.inDraw && this.$store.dispatch('conditions/add', param)
}, },
dateChange(value) { dateChange(value) {
// const nvalue = dateFormat(value, this.getFormat())
// console.log(nvalue)
this.setCondition() this.setCondition()
},
formatValues(values) {
if (!values || values.length === 0) {
return []
}
return values.map(value => dateFormat(value, this.getFormat()))
},
getFormat() {
let format = 'yyyy'
switch (this.options.attrs.type) {
case 'year':
format = 'yyyy'
break
case 'month':
format = 'yyyy-MM'
break
case 'date':
format = 'yyyy-MM-dd'
break
case 'daterange':
format = 'yyyy-MM-dd'
this.operator = 'in'
break
default:
format = 'yyyy'
break
}
return format
} }
} }
} }
......
...@@ -944,6 +944,7 @@ export default { ...@@ -944,6 +944,7 @@ export default {
version_num: 'Version number', version_num: 'Version number',
standard: 'Standard', standard: 'Standard',
enterprise: 'Enterprise', enterprise: 'Enterprise',
suport: 'Get technical support' suport: 'Get technical support',
update_success: 'Update Success'
} }
} }
...@@ -943,6 +943,7 @@ export default { ...@@ -943,6 +943,7 @@ export default {
version_num: '版本號', version_num: '版本號',
standard: '標準版', standard: '標準版',
enterprise: '企業版', enterprise: '企業版',
suport: '獲取技術支持' suport: '獲取技術支持',
update_success: '更新成功'
} }
} }
...@@ -945,6 +945,7 @@ export default { ...@@ -945,6 +945,7 @@ export default {
version_num: '版本号', version_num: '版本号',
standard: '标准版', standard: '标准版',
enterprise: '企业版', enterprise: '企业版',
suport: '获取技术支持' suport: '获取技术支持',
update_success: '更新成功'
} }
} }
...@@ -2,6 +2,26 @@ ...@@ -2,6 +2,26 @@
* Created by PanJiaChen on 16/11/18. * Created by PanJiaChen on 16/11/18.
*/ */
export function dateFormat(date, fmt) {
let ret
const opt = {
'y+': date.getFullYear().toString(), // 年
'M+': (date.getMonth() + 1).toString(), // 月
'd+': date.getDate().toString(), // 日
'H+': date.getHours().toString(), // 时
'm+': date.getMinutes().toString(), // 分
's+': date.getSeconds().toString() // 秒
// 有其他格式化字符需求可以继续添加,必须转化成字符串
}
for (const k in opt) {
ret = new RegExp('(' + k + ')').exec(fmt)
if (ret) {
fmt = fmt.replace(ret[1], (ret[1].length === 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, '0')))
}
}
return fmt
}
/** /**
* Parse the time to string * Parse the time to string
* @param {(Object|string|number)} time * @param {(Object|string|number)} time
......
...@@ -138,7 +138,7 @@ export default { ...@@ -138,7 +138,7 @@ export default {
const param = { license: this.licenseKey } const param = { license: this.licenseKey }
updateInfo(param).then(response => { updateInfo(param).then(response => {
if (response.data.status === 'valid') { if (response.data.status === 'valid') {
this.$success(this.$t('i18n_mc_update_success')) this.$success(this.$t('about.update_success'))
this.license = this.getLicense(response.data) this.license = this.getLicense(response.data)
} else { } else {
this.$warning(response.data.message) this.$warning(response.data.message)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论