|  |  |  | 
|---|
|  |  |  | <template> | 
|---|
|  |  |  | <TableLayout :permissions="['business:empower:query']"> | 
|---|
|  |  |  | <TableLayout :permissions="['business:carusebook:query']"> | 
|---|
|  |  |  | <!-- 搜索表单 --> | 
|---|
|  |  |  | <div ref="QueryFormRef" slot="search-form"> | 
|---|
|  |  |  | <el-form ref="searchForm" :model="searchForm" label-width="100px" inline> | 
|---|
|  |  |  | 
|---|
|  |  |  | <el-option label="市外用车" value="1"></el-option> | 
|---|
|  |  |  | </el-select> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | <el-form-item label="出发时间" prop="startTime"> | 
|---|
|  |  |  | <el-date-picker @change="seleTime" v-model="time" @keypress.enter.native="search" type="datetimerange" | 
|---|
|  |  |  | <el-form-item label="申请时间" prop="startTime"> | 
|---|
|  |  |  | <!-- <el-date-picker @change="seleTime" v-model="time" @keypress.enter.native="search" type="datetimerange" | 
|---|
|  |  |  | format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss" :default-time="['00:00:00', '23:59:59']" | 
|---|
|  |  |  | range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"> | 
|---|
|  |  |  | </el-date-picker> | 
|---|
|  |  |  | </el-date-picker> --> | 
|---|
|  |  |  | <el-date-picker type="datetime" v-model="searchForm.queryStartTime" value-format="yyyy-MM-dd HH:mm:ss" | 
|---|
|  |  |  | placeholder="请选择开始时间" @change="changeRadio" /> | 
|---|
|  |  |  | <el-date-picker type="datetime" v-model="searchForm.queryEndTime" value-format="yyyy-MM-dd HH:mm:ss" | 
|---|
|  |  |  | placeholder="请选择结束时间" @change="changeRadio" /> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | <el-radio-group v-model="searchForm.radio" size="small" @input="changeRadio"> | 
|---|
|  |  |  | <el-radio-button label="0">当天</el-radio-button> | 
|---|
|  |  |  | 
|---|
|  |  |  | <el-button type="primary" @click="handleEx" v-permissions="['business:carusebook:exportExcel']">导出</el-button> | 
|---|
|  |  |  | </li> | 
|---|
|  |  |  | </ul> | 
|---|
|  |  |  | <el-table :max-height="tableHeight" v-loading="isWorking.search" :data="tableData.list" stripe | 
|---|
|  |  |  | <el-table :height="tableHeightNew" v-loading="isWorking.search" :data="tableData.list" stripe | 
|---|
|  |  |  | @selection-change="handleSelectionChange"> | 
|---|
|  |  |  | <el-table-column type="selection" width="55"></el-table-column> | 
|---|
|  |  |  | <el-table-column prop="carCode" label="车牌号" min-width="100px"></el-table-column> | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <el-table-column prop="createDate" label="申请时间" min-width="150px"></el-table-column> | 
|---|
|  |  |  | <el-table-column prop="editDate" label="操作时间" min-width="150px"></el-table-column> | 
|---|
|  |  |  | <el-table-column label="操作" min-width="160" align="center" fixed="right"> | 
|---|
|  |  |  | <el-table-column label="操作" min-width="240" align="center" fixed="right"> | 
|---|
|  |  |  | <template slot-scope="{ row }"> | 
|---|
|  |  |  | <el-button type="text" icon="el-icon-edit" | 
|---|
|  |  |  | @click="$refs.OperaDetailsWindow.open('公务车申请详情', row)">查看详情</el-button> | 
|---|
|  |  |  | <!-- <el-button v-if="(row.status === 1 || row.status === 2) && new Date().getTime() < new Date(row.startTime).getTime()" type="text" icon="el-icon-delete" @click="rowRevokeClick(row)" >撤销</el-button> --> | 
|---|
|  |  |  | <el-button style="color: red" | 
|---|
|  |  |  | v-if="(row.status === 0 || row.status === 1 || row.status === 2) && new Date().getTime() < new Date(row.startTime).getTime()" | 
|---|
|  |  |  | type="text" icon="el-icon-delete" @click="rowRevokeClick(row)">撤销</el-button> | 
|---|
|  |  |  | <el-button style="color: red" type="text" icon="el-icon-delete" @click="deleteById(row)">删除</el-button> | 
|---|
|  |  |  | <el-button style="color: red" v-if="row.hasRole == 1" type="text" icon="el-icon-delete" | 
|---|
|  |  |  | @click="rowRevokeClick(row)">撤销</el-button> | 
|---|
|  |  |  | <!-- <el-button style="color: red"   v-if="(row.status === 0 && row.creator == userInfo.id)||((row.status === 0 || row.status === 1 ) || ( row.status === 2 && new Date().getTime() < new Date(row.startTime).getTime() ))"  type="text"  icon="el-icon-delete"   @click="rowRevokeClick(row)" >撤销</el-button>--> | 
|---|
|  |  |  | <el-button style="color: red" type="text" icon="el-icon-delete" | 
|---|
|  |  |  | v-permissions="['business:carusebook:delete']" @click="deleteById(row)">删除</el-button> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  | </el-table-column> | 
|---|
|  |  |  | </el-table> | 
|---|
|  |  |  | 
|---|
|  |  |  | components: { TableLayout, Pagination, OperaCarUseBookWindow, OperaCarUseBookParamWindow }, | 
|---|
|  |  |  | data() { | 
|---|
|  |  |  | return { | 
|---|
|  |  |  | // userInfo: this.$store.state.userInfo, | 
|---|
|  |  |  | // 搜索 | 
|---|
|  |  |  | searchForm: { | 
|---|
|  |  |  | memberName: '', | 
|---|
|  |  |  | 
|---|
|  |  |  | // this.search() | 
|---|
|  |  |  | this.changeRadio('0') | 
|---|
|  |  |  | this.loadParams() | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | mounted() { | 
|---|
|  |  |  | this.$nextTick(() => { | 
|---|
|  |  |  | this.tableHeight = document.body.scrollHeight - this.$refs.QueryFormRef.offsetHeight - 300 | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | methods: { | 
|---|
|  |  |  | rowRevokeClick(row) { | 
|---|
|  |  |  | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | changeRadio(e) { | 
|---|
|  |  |  | this.searchForm.radio = e | 
|---|
|  |  |  | if (e === '0') { | 
|---|
|  |  |  | this.searchForm.queryStartTime = timeForMat(0)[0] | 
|---|
|  |  |  | this.searchForm.queryEndTime = timeForMat(0)[1] | 
|---|
|  |  |  | this.time = timeForMat(0) | 
|---|
|  |  |  | } else if (e === '1') { | 
|---|
|  |  |  | this.searchForm.queryStartTime = timeForMat(6)[0] | 
|---|
|  |  |  | this.searchForm.queryEndTime = timeForMat(6)[1] | 
|---|
|  |  |  | this.time = timeForMat(6) | 
|---|
|  |  |  | } else if (e === '2') { | 
|---|
|  |  |  | this.searchForm.queryStartTime = timeForMat(29)[0] | 
|---|
|  |  |  | this.searchForm.queryEndTime = timeForMat(29)[1] | 
|---|
|  |  |  | this.time = timeForMat(29) | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | this.searchForm.radio = '' | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (this.searchForm.queryStartTime && this.searchForm.queryEndTime && new Date(this.searchForm.queryStartTime).getTime() > new Date(this.searchForm.queryEndTime).getTime()) { | 
|---|
|  |  |  | this.$message.error('开始时间不能大于结束时间') | 
|---|
|  |  |  | this.searchForm.queryStartTime = '' | 
|---|
|  |  |  | return | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.search() | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | seleTime(e) { | 
|---|
|  |  |  | this.searchForm.queryStartTime = e[0] | 
|---|
|  |  |  | this.searchForm.queryEndTime = e[1] | 
|---|
|  |  |  | this.searchForm.queryStartTime = null | 
|---|
|  |  |  | this.searchForm.queryEndTime = null | 
|---|
|  |  |  | if (e != null && e.length >= 2) { | 
|---|
|  |  |  | this.searchForm.queryStartTime = e[0] | 
|---|
|  |  |  | this.searchForm.queryEndTime = e[1] | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.searchForm.radio = null | 
|---|
|  |  |  | this.search() | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | reset() { | 
|---|
|  |  |  | this.$refs.searchForm.resetFields() | 
|---|
|  |  |  | this.searchForm.radio = '0' | 
|---|
|  |  |  | this.changeRadio('0') | 
|---|
|  |  |  | // this.search() | 
|---|
|  |  |  | this.searchForm = { | 
|---|
|  |  |  | memberName: '', | 
|---|
|  |  |  | companyName: '', | 
|---|
|  |  |  | queryStartTime: '', | 
|---|
|  |  |  | queryEndTime: '', | 
|---|
|  |  |  | type: null, | 
|---|
|  |  |  | status: null, | 
|---|
|  |  |  | radio: '' | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // this.changeRadio(0) | 
|---|
|  |  |  | this.search() | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|