Commit ff621b41 authored by leon's avatar leon

Merge branch 'develop' of http://106.15.103.105/lihuizhen/ec-report-refactor into develop

parents d0669e4a f72527c8
unpackage unpackage
unpackage/dist unpackage/dist
uni_modules
\ No newline at end of file
<template>
<view class="timer">
<NormalTitle :elementInfo="elementInfo"></NormalTitle>
<uni-datetime-picker
:type="elementInfo.option.dateTime.showTime ? 'datetime' : 'date'"
v-model="elementInfo.option.dateTime.date"
/>
</view>
</template>
<script>
export default {
name: "DatePicker",
props: {
elementInfo: {
type: Object,
required: true
}
},
data() {
return {
};
},
onReady() {
},
onUnLoad() {
},
methods: {
}
}
</script>
<style lang="scss" scoped>
.timer {
display: flex;
flex-flow: column;
justify-content: center;
width: 100%;
color: #fff;
}
</style>
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
zIndex: `${element.type == 'NormalTabs' ? 999999 : index + 1}` zIndex: `${element.type == 'NormalTabs' ? 999999 : index + 1}`
}" }"
> >
<DatePicker v-if="element.type == 'DateTimePicker'" :elementInfo="element"></DatePicker>
<!-- 普通柱状图 --> <!-- 普通柱状图 -->
<NormalBar v-if="element.type == 'NormalBar'" :elementInfo="element"></NormalBar> <NormalBar v-if="element.type == 'NormalBar'" :elementInfo="element"></NormalBar>
<!-- 普通折线图 --> <!-- 普通折线图 -->
...@@ -140,6 +141,19 @@ ...@@ -140,6 +141,19 @@
clearInterval(this.timename) clearInterval(this.timename)
}, },
methods: { methods: {
// 日期时间格式化
dateTimeFormat(val){
let date = new Date(val)
let year = date.getFullYear()
// 在日期格式中,月份是从0开始的,因此要加0,使用三元表达式在小于10的前面加0,以达到格式统一 如 09:11:05
let month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
let day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
let hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
let minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
let seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
// 拼接
return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
},
/** /**
* 递归 - 隐藏子项为NormalTabs的所有关联组件 * 递归 - 隐藏子项为NormalTabs的所有关联组件
*/ */
...@@ -208,6 +222,11 @@ ...@@ -208,6 +222,11 @@
}, parseInt(info.dataPollingInterval) * 1000) }, parseInt(info.dataPollingInterval) * 1000)
} }
} }
res.data.Result.list.forEach(item => {
if(item.type === 'DateTimePicker') {
item.option.dateTime.date = this.dateTimeFormat(item.option.dateTime.date)
}
})
that.reportInfo = res.data.Result that.reportInfo = res.data.Result
} }
}, },
......
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