123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218 |
- <template>
- <view class="modal-box">
- <u-popup v-model="isShow" @close="isShow=false" mode="right" length="85%" >
- <u-form :model="form" ref="uForm" label-width="150" class="form-content">
- <u-form-item label="扫描时间" prop="date" class="form-item">
- <u-input clearable v-model="form.date" @clear="clearTime" type="select" placeholder="请选择扫描时间区间" class="form-item-inp" @click="showDate=true" />
- </u-form-item>
- <u-form-item label="VIN"><u-input v-model.trim="form.vinCode" placeholder="请输入VIN"/></u-form-item>
- <u-form-item label="车辆品牌"><u-input v-model.trim="form.brandName" placeholder="请输入车辆品牌"/></u-form-item>
- <u-form-item label="车型"><u-input v-model.trim="form.modelInfo" placeholder="请输入车型"/></u-form-item>
- <u-form-item label="空调滤清器" label-position="top">
- <u-checkbox-group :size="28">
- <u-checkbox
- v-for="(item, index) in list0"
- :key="index"
- :name="item.val"
- v-model="item.checked"
- :disabled="item.disabled"
- @change="(e)=>{checkboxChange(e,'airConditionerFilterFlag',list0)}"
- >
- {{item.name}}
- </u-checkbox>
- </u-checkbox-group>
- </u-form-item>
- <u-form-item label="空气滤清器" label-position="top">
- <u-checkbox-group :size="28">
- <u-checkbox
- v-for="(item, index) in list1"
- :key="index"
- :name="item.val"
- :disabled="item.disabled"
- v-model="item.checked"
- @change="(e)=>{checkboxChange(e,'airFilterFlag',list1)}"
- >
- {{item.name}}
- </u-checkbox>
- </u-checkbox-group>
- </u-form-item>
- <u-form-item label="机油滤清器" label-position="top">
- <u-checkbox-group :size="28">
- <u-checkbox
- v-for="(item, index) in list2"
- :key="index"
- :name="item.val"
- :disabled="item.disabled"
- v-model="item.checked"
- @change="(e)=>{checkboxChange(e,'engineOilFilterFlag',list2)}"
- >
- {{item.name}}
- </u-checkbox>
- </u-checkbox-group>
- </u-form-item>
- </u-form>
- <view class="form-footer-btn">
- <u-button class="handle-btn" shape="circle" size="medium" hover-class="none" @click="handleClean">重置</u-button>
- <u-button class="handle-btn" shape="circle" size="medium" hover-class="none" :custom-style="customBtnStyle" @click="handleSearch">查询</u-button>
- </view>
- </u-popup>
- <!-- 选择日期范围 -->
- <u-calendar v-model="showDate" ref="dataInit" @change="dateChange" mode="range"></u-calendar>
- </view>
- </template>
- <script>
- export default{
- components: { },
- props:{
- showModal:{
- type: Boolean,
- default: false
- }
- },
- data(){
- return{
- form: {
- date: '',
- beginDate: '',
- endDate: '',
- airConditionerFilterFlag:null,
- airFilterFlag:null,
- engineOilFilterFlag:null,
- vinCode: undefined,
- brandName: undefined,//车辆品牌
- modelInfo: undefined//车型
- },
- customBtnStyle: { // 自定义按钮样式
- borderColor: this.$config('primaryColor'),
- backgroundColor: this.$config('primaryColor'),
- color: '#fff'
- },
- list: [
- {
- name: '有适配',
- val:1,
- disabled: false,
- checked: false
- },
- {
- name: '无适配',
- val:2,
- disabled: false,
- checked: false
- },
- {
- name: '空(--)',
- val:0,
- disabled: false,
- checked: false
- }
- ],
- list0:[],
- list1:[],
- list2:[],
- showDate: false, // 是否显示时间弹窗
- isShow:this.showModal,
- showTypeModal: false,
- brandModal:false
- }
- },
- methods:{
- // 时间 change
- dateChange(date){
- this.form.date = date.startDate + ' ~ ' + date.endDate
- this.form.beginDate = date.startDate + ' 00:00:00'
- this.form.endDate = date.endDate + ' 23:59:59'
- },
- // 清空创建时间
- clearTime(){
- this.$refs.dataInit.init();
- this.form.date = ''
- this.form.beginDate = ''
- this.form.endDate = ''
- },
- checkboxChange(e,key,list){
- list.map(item => {
- item.checked = item.val == e.name
- })
- this.form[key] = e.value ? e.name : ''
- },
- // 表单清空
- handleClean(){
- this.form={
- date: '',
- beginDate: '',
- endDate: '',
- airConditionerFilterFlag:null,
- airFilterFlag:null,
- engineOilFilterFlag:null,
- vinCode: undefined,
- brandName: undefined,//车辆品牌
- modelInfo: undefined//车型
- }
- this.$refs.dataInit.init();
- setTimeout(()=>{
- this.handleSearch()
- },300)
- },
- handleSearch(){
- let data = JSON.parse(JSON.stringify(this.form))
- this.$emit('refresh', data)
- this.isShow=false
- },
- setOptionVal(list,key){
- list.map(item => {
- item.checked = item.val === this.form[key]
- })
- }
- },
- watch:{
- // 父页面传过来的弹框状态
- showModal (newValue, oldValue) {
- this.isShow = newValue
- },
- // 重定义的弹框状态
- isShow (newValue, oldValue) {
- if (!newValue) {
- this.$emit('close')
- }else{
- this.list0 = JSON.parse(JSON.stringify(this.list))
- this.list1 = JSON.parse(JSON.stringify(this.list))
- this.list2 = JSON.parse(JSON.stringify(this.list))
- this.setOptionVal(this.list0,'airConditionerFilterFlag')
- this.setOptionVal(this.list1,'airFilterFlag')
- this.setOptionVal(this.list2,'engineOilFilterFlag')
- }
- }
- }
- }
- </script>
- <style lang="scss">
- .modal-box{
- width: 100%;
- .form-content{
- display: block;
- padding: 0 20upx;
- box-sizing: content-box;
- }
- .u-form-item{
- padding: 10upx;
- }
- .form-footer-btn{
- margin: 30upx;
- display: flex;
- justify-content: space-between;
- }
- .form-footer-btn {
- display: flex;
- padding: 20upx;
- .handle-btn {
- font-size: 28upx;
- margin: 0 30upx;
- width: 100%;
- flex: 1;
- }
- }
- }
- </style>
|