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) => { ...@@ -27,7 +27,6 @@ const install = (Vue, vm) => {
config.header.Authorization = vm.vuex_token config.header.Authorization = vm.vuex_token
config.header.requestId = vm.$u.guid() config.header.requestId = vm.$u.guid()
config.header.source = "wechat" config.header.source = "wechat"
return config return config
}, (config) => { }, (config) => {
return Promise.reject(config) return Promise.reject(config)
......
...@@ -3,22 +3,23 @@ ...@@ -3,22 +3,23 @@
<NormalTitle :elementInfo="elementInfo"></NormalTitle> <NormalTitle :elementInfo="elementInfo"></NormalTitle>
<view class="date-wrap"> <view class="date-wrap">
<u-input <u-input
style="width:'100%'" style="width:100%"
placeholder="请输入日期" placeholder="请输入日期"
input-align="center" input-align="center"
v-model="elementInfo.option.dateTime.date" v-model="pickerValue"
type="select" type="select"
:select-open="pickerTime" :select-open="show"
:border="true" :border="true"
@click="pickerTime = true" :borderColor="elementInfo.option.dateTime.borderColor"
:custom-style="{color: '#fff'}" :custom-style="{color: elementInfo.option.dateTime.color}"
@click="show = true"
></u-input> ></u-input>
</view> </view>
<u-picker <u-picker
mode="time" mode="time"
v-model="pickerTime" v-model="show"
@confirm="timeConfirm" @confirm="timeConfirm"
:default-time="elementInfo.option.dateTime.date ? elementInfo.option.dateTime.date : null" :default-time="pickerValue ? pickerValue : ''"
:params="elementInfo.option.dateTime.showTime ? timeParams : dateParams" :params="elementInfo.option.dateTime.showTime ? timeParams : dateParams"
></u-picker> ></u-picker>
</view> </view>
...@@ -50,14 +51,13 @@ ...@@ -50,14 +51,13 @@
minute: true, minute: true,
second: true second: true
}, },
pickerTime: false show: false,
pickerValue: ''
}; };
}, },
onReady() { mounted() {
this.pickerValue = this.dateTimeFormat(this.elementInfo.option.dateTime.date)
},
onUnLoad() {
}, },
methods: { methods: {
timeConfirm(e){ timeConfirm(e){
...@@ -67,11 +67,32 @@ ...@@ -67,11 +67,32 @@
const hour =e.hour const hour =e.hour
const minute = e.minute const minute = e.minute
const second = e.second const second = e.second
const dateTime = `${year}-${month}-${day} ${hour}:${minute}:${second}` if(this.elementInfo.option.dateTime.showTime) {
this.$emit('changeDateTime', { this.pickerValue = `${year}-${month}-${day} ${hour}:${minute}:${second}`
id: this.elementInfo.id, } else {
time: dateTime 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 @@ ...@@ -85,7 +106,7 @@
flex-flow: column; flex-flow: column;
justify-content: center; justify-content: center;
width: 100%; width: 100%;
color: #fff; // color: #fff;
} }
</style> </style>
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
height: `${parseInt(element.height * scale)}px`, height: `${parseInt(element.height * scale)}px`,
left: `${parseInt(element.left * scale)}px`, left: `${parseInt(element.left * scale)}px`,
top: `${parseInt(element.top * 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> <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