<template>
|
<view>
|
<cu-custom bgColor="bg-gradual-blue" :isBack="true">
|
<block slot="content">生产记录分析</block>
|
</cu-custom>
|
|
|
<view class="card-box dynamic shadow">
|
<view class="title-box">
|
<view class="left">
|
<uni-text class="cuIcon-titles text-blue"></uni-text>
|
<view class="title">日期</view>
|
</view>
|
</view>
|
|
|
<u-form labelPosition="left" :model="model" ref="form">
|
<view class="input-box padding-lr userinfo-box">
|
|
<u-form-item label="开始日期" labelWidth="80" prop="date1" @click="show1 = true;" borderBottom>
|
<u--input v-model="model.date1" disabled disabledColor="#ffffff" placeholder="请选择开始日期"
|
border="none"></u--input>
|
<u-icon slot="right" name="arrow-right"></u-icon>
|
<u-datetime-picker :show="show1" @confirm="confirm1" @cancel="cancel1" @close="close1" mode="date" ref="date1">
|
</u-datetime-picker>
|
</u-form-item>
|
|
<u-form-item label="结束日期" labelWidth="80" prop="date2" @click="show2 = true;"
|
borderBottom>
|
<u--input v-model="model.date2" disabled disabledColor="#ffffff" placeholder="请选择结束日期"
|
border="none"></u--input>
|
<u-icon slot="right" name="arrow-right"></u-icon>
|
<u-datetime-picker :show="show2" @confirm="confirm2" @cancel="cancel2" @close="close2" mode="date" ref="date2">
|
</u-datetime-picker>
|
</u-form-item>
|
|
</view>
|
|
<view class="padding margin-top-xs">
|
<button @click="submit" class="cu-btn block bg-blue margin-tb-sm lg">查询分析</button>
|
</view>
|
</u-form>
|
|
</view>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
show1: false,
|
show2: false,
|
model: {
|
date1: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
|
date2: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd')
|
},
|
rules: {
|
'date1': {
|
type: 'string',
|
required: true,
|
message: '请选择开始日期',
|
trigger: ['change']
|
},
|
'date2': {
|
type: 'string',
|
required: true,
|
message: '请选择结束日期',
|
trigger: ['change']
|
},
|
},
|
}
|
},
|
methods: {
|
submit(){
|
this.$refs.form.validate().then(res => {
|
uni.$u.toast('校验通过')
|
uni.navigateTo({
|
url:"/pages/analy/analyList"
|
})
|
|
}).catch(errors => {
|
uni.$u.toast('校验失败')
|
})
|
},
|
confirm1(e) {
|
const timeFormat = uni.$u.timeFormat
|
let date1 = timeFormat(e.value, 'yyyy-mm-dd')
|
this.model.date1 = date1
|
this.show1 = false
|
|
},
|
confirm2(e) {
|
const timeFormat = uni.$u.timeFormat
|
let date2 = timeFormat(e.value, 'yyyy-mm-dd')
|
this.model.date2 = date2
|
this.show2 = false
|
|
},
|
cancel1() {
|
this.show1 = false
|
},
|
cancel2() {
|
this.show2 = false
|
},
|
close1() {
|
this.show1 = false
|
},
|
close2() {
|
this.show2 = false
|
},
|
},
|
onReady() {
|
//onReady 为uni-app支持的生命周期之一
|
this.$refs.form.setRules(this.rules)
|
|
},
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.card-box {
|
margin: 20rpx;
|
padding: 20rpx;
|
box-sizing: border-box;
|
background-color: white;
|
border-radius: 20rpx;
|
font-family: Helvetica Neue, Helvetica, sans-serif;
|
|
.left {
|
display: flex;
|
align-items: center;
|
|
.title {
|
margin: 0 10rpx;
|
font-size: 34rpx;
|
font-weight: bold;
|
}
|
}
|
|
}
|
</style>
|