Commit 46b724d5 authored by lxm's avatar lxm

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

# Conflicts:
#	pages/index/index.vue
parents d764ef22 a3f2e721
......@@ -27,7 +27,6 @@ const install = (Vue, vm) => {
config.header.Authorization = vm.vuex_token
config.header.requestId = vm.$u.guid()
config.header.source = "wechat"
return config
}, (config) => {
return Promise.reject(config)
......
......@@ -3,22 +3,23 @@
<NormalTitle :elementInfo="elementInfo"></NormalTitle>
<view class="date-wrap">
<u-input
style="width:'100%'"
style="width:100%"
placeholder="请输入日期"
input-align="center"
v-model="elementInfo.option.dateTime.date"
v-model="pickerValue"
type="select"
:select-open="pickerTime"
:select-open="show"
:border="true"
@click="pickerTime = true"
:custom-style="{color: '#fff'}"
:borderColor="elementInfo.option.dateTime.borderColor"
:custom-style="{color: elementInfo.option.dateTime.color}"
@click="show = true"
></u-input>
</view>
<u-picker
mode="time"
v-model="pickerTime"
v-model="show"
@confirm="timeConfirm"
:default-time="elementInfo.option.dateTime.date ? elementInfo.option.dateTime.date : null"
:default-time="pickerValue ? pickerValue : ''"
:params="elementInfo.option.dateTime.showTime ? timeParams : dateParams"
></u-picker>
</view>
......@@ -50,28 +51,48 @@
minute: true,
second: true
},
pickerTime: false
show: false,
pickerValue: ''
};
},
onReady() {
},
onUnLoad() {
mounted() {
this.pickerValue = this.dateTimeFormat(this.elementInfo.option.dateTime.date)
},
methods: {
timeConfirm(e){
const year = e.year
const month = e.month
const day = e.day
const hour =e.hour
const minute = e.minute
const year = e.year
const month = e.month
const day = e.day
const hour =e.hour
const minute = e.minute
const second = e.second
const dateTime = `${year}-${month}-${day} ${hour}:${minute}:${second}`
this.$emit('changeDateTime', {
id: this.elementInfo.id,
time: dateTime
})
if(this.elementInfo.option.dateTime.showTime) {
this.pickerValue = `${year}-${month}-${day} ${hour}:${minute}:${second}`
} else {
this.pickerValue = `${year}-${month}-${day}`
}
const { index, paramName, data } = this.elementInfo.child
if(index.length) {
uni.$emit('handleLinkParams', { index, paramName, value: this.pickerValue })
}
},
// 日期时间格式化
dateTimeFormat(val){
const date = new Date(val)
const year = date.getFullYear()
// 在日期格式中,月份是从0开始的,因此要加0,使用三元表达式在小于10的前面加0,以达到格式统一 如 09:11:05
const month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
const day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
const hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
const minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
const seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
// 拼接
if(this.elementInfo.option.dateTime.showTime) {
return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
}
return year + "-" + month + "-" + day;
},
}
}
......@@ -85,7 +106,7 @@
flex-flow: column;
justify-content: center;
width: 100%;
color: #fff;
// color: #fff;
}
</style>
......@@ -11,7 +11,7 @@
height: `${parseInt(element.height * scale)}px`,
left: `${parseInt(element.left * scale)}px`,
top: `${parseInt(element.top * scale)}px`,
zIndex: `${element.type == 'NormalTabs' ? 999999 : index + 1}`
zIndex: `${element.type == 'NormalTabs' || element.type == 'DateTimePicker' ? 999999 : index + 1}`
}"
>
<DatePicker v-if="element.type == 'DateTimePicker'" @changeDateTime = "changeDateTime" :elementInfo="element"></DatePicker>
......
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