|  |  | 
 |  |  |           > | 
 |  |  |         </el-form-item> | 
 |  |  |         <el-form-item label="选择车辆" prop="carId"> | 
 |  |  |           <el-select v-model="form.carId" placeholder="选择车辆"> | 
 |  |  |           <el-select v-model="form.carId" @change="clearTime" placeholder="选择车辆"> | 
 |  |  |             <el-option | 
 |  |  |               v-for="item in carsList" | 
 |  |  |               :key="item.id" | 
 |  |  | 
 |  |  |                 :class="{ | 
 |  |  |                   disable: item.isUse == 1, | 
 |  |  |                   active: item.checked == '1', | 
 |  |  |                   hasSub: item.carUseBookId, | 
 |  |  |                 }" | 
 |  |  |                 @click="datetimeClick(item, i)" | 
 |  |  |                 v-for="(item, i) in timeList" | 
 |  |  | 
 |  |  |       :visible.sync="isShowShiwai" | 
 |  |  |       append-to-body | 
 |  |  |       width="600px" | 
 |  |  |       :before-close="clearTime" | 
 |  |  |     > | 
 |  |  |       <el-form :model="form" ref="modalRef" class="el_form" :rules="rules"> | 
 |  |  |         <el-form-item label="用车开始时间" prop="startTime"> | 
 |  |  | 
 |  |  |       <div class="have_info" v-if="info && info.length > 0"> | 
 |  |  |         <div class="tit">您申请的用车时段已有车辆预约</div> | 
 |  |  |         <div class="content" v-for="(item, i) in info" :key="i"> | 
 |  |  |           <div class="card">{{ item.carCode }}</div> | 
 |  |  |           <div class="df_sb"> | 
 |  |  |             <span class="card" v-if="item.carCode">{{ item.carCode }}</span> | 
 |  |  |             <span>{{ i + 1 }}/{{ info.length }}</span> | 
 |  |  |           </div> | 
 |  |  |           <div class="line"> | 
 |  |  |             <span>用车时段</span> | 
 |  |  |             <span> | 
 |  |  | 
 |  |  |           </div> | 
 |  |  |           <div class="line"> | 
 |  |  |             <span>申请人</span> | 
 |  |  |             <span>{{ item.memberName }} {{ item.memberMobile }}</span> | 
 |  |  |             <span>{{ item.memberName }} <span class="primaryColor">{{ item.memberMobile }}</span></span> | 
 |  |  |           </div> | 
 |  |  |         </div> | 
 |  |  |       </div> | 
 |  |  |  | 
 |  |  |       <span slot="footer" class="dialog-footer"> | 
 |  |  |         <div>已选择:{{ selDatetime }}</div> | 
 |  |  |         <div class="btn" @click="subTime">确认时间</div> | 
 |  |  |         <div class="btn" :class="{disable: info && info.length > 0}" @click="subTime">确认时间</div> | 
 |  |  |       </span> | 
 |  |  |     </el-dialog> | 
 |  |  |     <!-- 详情 --> | 
 |  |  |      <el-dialog | 
 |  |  |       title="选择用车时间" | 
 |  |  |       :visible.sync="isShowDetail" | 
 |  |  |       append-to-body | 
 |  |  |       width="600px" | 
 |  |  |     > | 
 |  |  |       <div class="detail_modal"> | 
 |  |  |         <div class="title">车辆预约情况</div> | 
 |  |  |         <div class="h1" v-if="activeInfo.carCode">{{ activeInfo.carCode }}</div> | 
 |  |  |         <div class="line"> | 
 |  |  |           <div class="label">预计用车时段</div> | 
 |  |  |           <div class="value" v-if="activeInfo.startTime">{{ activeInfo.startTime.slice(5, 16) }} - {{ activeInfo.endTime.slice(5, 16) }}</div> | 
 |  |  |         </div> | 
 |  |  |         <div class="line"> | 
 |  |  |           <div class="label">目的地</div> | 
 |  |  |           <div class="value">{{ activeInfo.addr }}</div> | 
 |  |  |         </div> | 
 |  |  |         <div class="line"> | 
 |  |  |           <div class="label">乘车人数</div> | 
 |  |  |           <div class="value" v-if="activeInfo.memberIds">{{ activeInfo.memberIds.split(',').length }}人</div> | 
 |  |  |         </div> | 
 |  |  |         <div class="line"> | 
 |  |  |           <div class="label">用车事由</div> | 
 |  |  |           <div class="value">{{ activeInfo.content || '' }}</div> | 
 |  |  |         </div> | 
 |  |  |         <div class="line"> | 
 |  |  |           <div class="label">申请人</div> | 
 |  |  |           <div class="value">{{ activeInfo.memberName }} <span class="primaryColor ml12">{{ activeInfo.memberPhone }}</span></div> | 
 |  |  |         </div> | 
 |  |  |       </div> | 
 |  |  |      </el-dialog> | 
 |  |  |   </GlobalWindow> | 
 |  |  | </template> | 
 |  |  |  | 
 |  |  | 
 |  |  | import GlobalWindow from '@/components/common/GlobalWindow' | 
 |  |  | import { allList } from '@/api/business/member' | 
 |  |  | import { allList as getCarList } from '@/api/business/cars' | 
 |  |  | import { carCanReservationDate, carUseBookCraete, carUseBookList } from '@/api/business/carUseBook' | 
 |  |  | import { carCanReservationDate, carUseBookCraete, carUseBookList, detail } from '@/api/business/carUseBook' | 
 |  |  | import { findTypeMemberInfo } from '@/api/business/memberCard' | 
 |  |  | import dayjs from 'dayjs' | 
 |  |  |  | 
 |  |  | export default { | 
 |  |  |   name: 'OperCarUseBookParamWindow', | 
 |  |  |   extends: BaseOpera, | 
 |  |  |   components: { GlobalWindow }, | 
 |  |  |   data() { | 
 |  |  |   data () { | 
 |  |  |     return { | 
 |  |  |       // 表单数据 | 
 |  |  |       isShowTime: false, | 
 |  |  | 
 |  |  |         endTime: '', | 
 |  |  |         memberIds: [] | 
 |  |  |       }, | 
 |  |  |       activeInfo: {}, | 
 |  |  |       isShowDetail: false, | 
 |  |  |       carBookInfo: {}, | 
 |  |  |       pickerOptions: { | 
 |  |  |         disabledDate: (time) => { | 
 |  |  |           if (this.form.startTime) { | 
 |  |  | 
 |  |  |   }, | 
 |  |  |   watch: { | 
 |  |  |     'form.planUseDate': { | 
 |  |  |       handler(newValue, oldValue) { | 
 |  |  |       handler (newValue, oldValue) { | 
 |  |  |         if (newValue) { | 
 |  |  |           this.$set(this.pickerOptions, 'selectableRange', this.form.startTime.slice(11, 19) + ' - ' + this.form.endTime.slice(11, 19)) | 
 |  |  |           // this.startPickerOptions = this.startPickerOptions | 
 |  |  | 
 |  |  |       immediate: true | 
 |  |  |     }, | 
 |  |  |     'form.startTime': { | 
 |  |  |       handler(newValue, oldValue) { | 
 |  |  |       handler (newValue, oldValue) { | 
 |  |  |         if (newValue) { | 
 |  |  |           this.$set(this.pickerOptions, 'selectableRange', this.form.startTime.slice(11, 19) + ' - ' + '23:59:59') | 
 |  |  |           // this.startPickerOptions = this.startPickerOptions | 
 |  |  | 
 |  |  |       immediate: true | 
 |  |  |     } | 
 |  |  |   }, | 
 |  |  |   created() { | 
 |  |  |   created () { | 
 |  |  |     this.initData() | 
 |  |  |   }, | 
 |  |  |   methods: { | 
 |  |  |     open() { | 
 |  |  |     open () { | 
 |  |  |       this.title = '新建公务车用车申请' | 
 |  |  |       this.form = { | 
 |  |  |         type: 0, | 
 |  |  | 
 |  |  |       }) | 
 |  |  |       this.visible = true | 
 |  |  |     }, | 
 |  |  |     confirm() { | 
 |  |  |     confirm () { | 
 |  |  |       const form = JSON.parse(JSON.stringify(this.form)) | 
 |  |  |       this.$refs.formRef.validate((valid) => { | 
 |  |  |         const memberList = [] | 
 |  |  | 
 |  |  |         } | 
 |  |  |       }) | 
 |  |  |     }, | 
 |  |  |     openTime() { | 
 |  |  |     openTime () { | 
 |  |  |       const { form } = this | 
 |  |  |       if (!form.carId) { | 
 |  |  |         return this.$tip.error('请先选择车辆') | 
 |  |  |       } | 
 |  |  |       if (this.form.type === 0) { | 
 |  |  |         this.$set(this.form, 'dateDay', '') | 
 |  |  |         this.timeList = [] | 
 |  |  |         this.isShowTime = true | 
 |  |  |       } else { | 
 |  |  |         this.clearTime() | 
 |  |  |         this.isShowShiwai = true | 
 |  |  |       } | 
 |  |  |     }, | 
 |  |  |     subTime() { | 
 |  |  |     clearTime () { | 
 |  |  |       this.isShowShiwai = false | 
 |  |  |       this.$set(this.form, 'startTime', '') | 
 |  |  |       this.$set(this.form, 'endTime', '') | 
 |  |  |       this.$nextTick(() => { | 
 |  |  |         if (this.$refs.modalRef) { | 
 |  |  |           this.$refs.modalRef.clearValidate() | 
 |  |  |         } | 
 |  |  |       }) | 
 |  |  |     }, | 
 |  |  |     subTime () { | 
 |  |  |       if (this.info && this.info.length > 0) return | 
 |  |  |       if (this.form.type === 0) { | 
 |  |  |         const selTimeList = this.timeList.filter(i => i.checked == '1') | 
 |  |  |         if (selTimeList.length === 0) { | 
 |  |  | 
 |  |  |         this.$forceUpdate() | 
 |  |  |       } else { | 
 |  |  |         this.$refs.modalRef.validate((valid) => { | 
 |  |  |           const { form } = this | 
 |  |  |           if (new Date(form.startTime).getTime() > new Date(form.endTime).getTime()) { | 
 |  |  |             return this.$tip.error('结束时间应大于开始时间') | 
 |  |  |           } | 
 |  |  |           this.isShowShiwai = false | 
 |  |  |         }) | 
 |  |  |       } | 
 |  |  |     }, | 
 |  |  |     datetimeClick(item, index) { | 
 |  |  |     datetimeClick (item, index) { | 
 |  |  |       if (item.carUseBookId) { | 
 |  |  |         detail( | 
 |  |  |           item.carUseBookId | 
 |  |  |         ).then(res => { | 
 |  |  |           this.activeInfo = res | 
 |  |  |           this.isShowDetail = true | 
 |  |  |         }) | 
 |  |  |         return | 
 |  |  |       } | 
 |  |  |       if (item.isUse == '1') return | 
 |  |  |       const { timeList } = this | 
 |  |  |       const selTimeList = timeList.filter(i => i.checked == '1') | 
 |  |  | 
 |  |  |         this.selDatetime = this.form.dateDay.slice(5) + ' ' + selTimeLists[0].startHours + '-' + selTimeLists[selTimeLists.length - 1].endHours | 
 |  |  |       } | 
 |  |  |     }, | 
 |  |  |     seletedDate(e) { | 
 |  |  |     seletedDate (e) { | 
 |  |  |       this.gettimes() | 
 |  |  |     }, | 
 |  |  |     seletedShiwaiDate() { | 
 |  |  |     seletedShiwaiDate () { | 
 |  |  |       const { form } = this | 
 |  |  |       if (form.startTime && form.endTime) { | 
 |  |  |         this.selDatetime = form.startTime + '-' + form.endTime | 
 |  |  | 
 |  |  |         }) | 
 |  |  |       } | 
 |  |  |     }, | 
 |  |  |     gettimes() { | 
 |  |  |     gettimes () { | 
 |  |  |       const { form } = this | 
 |  |  |       carCanReservationDate({ | 
 |  |  |         dateDay: form.dateDay, | 
 |  |  | 
 |  |  |         this.timeList = res || [] | 
 |  |  |         this.timeList.forEach((i, j) => { | 
 |  |  |           i.checked = '0', | 
 |  |  |             i.index = j | 
 |  |  |           i.index = j | 
 |  |  |         }) | 
 |  |  |       }) | 
 |  |  |     }, | 
 |  |  |     initData() { | 
 |  |  |     initData () { | 
 |  |  |       getCarList({ | 
 |  |  |         type: 1 | 
 |  |  |       }).then(res => { | 
 |  |  |         this.carsList = res | 
 |  |  |       }) | 
 |  |  |       findTypeMemberInfo({ | 
 |  |  |         type: '2' | 
 |  |  |         type: '2', | 
 |  |  |         companyType: 1 | 
 |  |  |       }).then(res => { | 
 |  |  |         this.memberList = res || [] | 
 |  |  |       }) | 
 |  |  | 
 |  |  |     background-color: #cccccc; | 
 |  |  |     color: #999999; | 
 |  |  |   } | 
 |  |  |   .hasSub { | 
 |  |  |       color: #fff; | 
 |  |  |       background: #cccccc; | 
 |  |  |     } | 
 |  |  | } | 
 |  |  | .color_op { | 
 |  |  |   display: flex; | 
 |  |  | 
 |  |  |     color: #fff; | 
 |  |  |     width: 120px; | 
 |  |  |     text-align: center; | 
 |  |  |     cursor: pointer; | 
 |  |  |   } | 
 |  |  |   .disable{ | 
 |  |  |     background: #cccccc; | 
 |  |  |   } | 
 |  |  | } | 
 |  |  | .have_info { | 
 |  |  | 
 |  |  |     } | 
 |  |  |   } | 
 |  |  | } | 
 |  |  | .detail_modal { | 
 |  |  |   padding: 20px 15px; | 
 |  |  |   .title { | 
 |  |  |     text-align: center; | 
 |  |  |     font-weight: 600; | 
 |  |  |     font-size: 16px; | 
 |  |  |     margin-bottom: 20px; | 
 |  |  |   } | 
 |  |  |   .h1 { | 
 |  |  |     font-weight: 600; | 
 |  |  |     font-size: 16px; | 
 |  |  |     margin-bottom: 16px; | 
 |  |  |   } | 
 |  |  |   .line { | 
 |  |  |     display: flex; | 
 |  |  |     margin-bottom: 10px; | 
 |  |  |     .label { | 
 |  |  |       width: 120px; | 
 |  |  |       color: #888888; | 
 |  |  |     } | 
 |  |  |     .value { | 
 |  |  |       color: #333333; | 
 |  |  |     } | 
 |  |  |   } | 
 |  |  | } | 
 |  |  | </style> |