|  |  | 
 |  |  | <template> | 
 |  |  |   <div class="main_app"> | 
 |  |  |     <QueryForm v-model="filters" :query-form-config="queryFormConfig" @changeForm='changeForm' @handleQuery="getList(1)" @clear="clear"> | 
 |  |  |     <QueryForm v-model="filters" :query-form-config="queryFormConfig" @changeForm='changeForm' @handleQuery="getList(1)" | 
 |  |  |       @clear="clear"> | 
 |  |  |       <template #fastdate> | 
 |  |  |         <el-radio-group | 
 |  |  |           v-model="filters.fastdate" | 
 |  |  |           size="small" | 
 |  |  |           @input="changeRadio" | 
 |  |  |         > | 
 |  |  |         <el-radio-group v-model="filters.fastdate" size="small" @input="changeRadio"> | 
 |  |  |           <el-radio-button label="0">当天</el-radio-button> | 
 |  |  |           <el-radio-button label="6">近7天</el-radio-button> | 
 |  |  |           <el-radio-button label="29">近30天</el-radio-button> | 
 |  |  | 
 |  |  |     <div class="pt16"> | 
 |  |  |       <el-button type="primary" @click="handleEdit" icon="el-icon-plus" | 
 |  |  |         v-permissions="['business:platformbooks:create']">新建</el-button> | 
 |  |  |       <el-button :loading="exLoading" @click="handleEx" v-permissions="['business:platformbooks:exportExcel']">导出</el-button> | 
 |  |  |       <el-button :loading="exLoading" @click="handleEx" | 
 |  |  |         v-permissions="['business:platformbooks:exportExcel']">导出</el-button> | 
 |  |  |     </div> | 
 |  |  |     <el-table class="mb20" v-loading="loading" :data="list" stripe> | 
 |  |  |     <el-table :height="tableHeightNew" v-loading="loading" :data="list" stripe> | 
 |  |  |       <el-table-column prop="contractNum" label="合同单号" min-width="100" show-overflow-tooltip /> | 
 |  |  |       <el-table-column prop="inReason" label="入园原因" min-width="100" show-overflow-tooltip /> | 
 |  |  |       <el-table-column prop="totalNum" label="总作业量(万支)" min-width="100" show-overflow-tooltip /> | 
 |  |  | 
 |  |  |       <el-table-column prop="driverPhone" label="联系方式" min-width="100" show-overflow-tooltip /> | 
 |  |  |       <el-table-column prop="inTypeTemp" label="入库类型" min-width="100" show-overflow-tooltip /> | 
 |  |  |       <el-table-column prop="arriveDate" label="预约到场时间" min-width="150" show-overflow-tooltip /> | 
 |  |  |       <el-table-column prop="auditName" label="审批结果" min-width="100" show-overflow-tooltip> | 
 |  |  |       <el-table-column label="审批结果" min-width="100" show-overflow-tooltip> | 
 |  |  |         <template v-slot="scope"> | 
 |  |  |           <span v-if="scope.row.status == '0'">待审批</span> | 
 |  |  |           <span v-if="scope.row.status == '1'">审批中</span> | 
 |  |  | 
 |  |  |           <span v-if="scope.row.status == '4'">已取消</span> | 
 |  |  |         </template> | 
 |  |  |       </el-table-column> | 
 |  |  |       <el-table-column prop="name" label="当前审批人" min-width="100" show-overflow-tooltip /> | 
 |  |  |       <el-table-column prop="auditName" label="当前审批人" min-width="100" show-overflow-tooltip /> | 
 |  |  |       <el-table-column prop="editDate" label="操作时间" min-width="150" show-overflow-tooltip /> | 
 |  |  |       <el-table-column prop="name" label="操作" min-width="120" align="center" fixed="right" show-overflow-tooltip> | 
 |  |  |         <template v-slot="scope"> | 
 |  |  |           <el-button type="text" v-permissions="['business:platformbooks:detail']" | 
 |  |  |             @click="handleDetail(scope.row)">预约详情</el-button> | 
 |  |  |           <el-button  type="text" class="red" v-permissions="['business:platformbooks:delete']" @click="handleDel(scope.row)">删除</el-button> | 
 |  |  |         </template> | 
 |  |  |       </el-table-column> | 
 |  |  |     </el-table> | 
 |  |  | 
 |  |  |       <el-form :model="param" :rules="rules" ref="ruleForm" label-width="100px"> | 
 |  |  |         <div class="param_title">运输信息</div> | 
 |  |  |         <el-form-item label="入园原因" prop="reasonId"> | 
 |  |  |           <el-select v-model="param.reasonId" class="w300" placeholder="请选择"> | 
 |  |  |           <el-select v-model="param.reasonId" @change="checkSurplus" class="w300" placeholder="请选择"> | 
 |  |  |             <el-option v-for="item in reasonList" :key="item.id" :label="item.reason" :value="item.id"> | 
 |  |  |             </el-option> | 
 |  |  |           </el-select> | 
 |  |  | 
 |  |  |           <el-input v-model="param.contractNum" class="w300" placeholder="请输入合同号"></el-input> | 
 |  |  |         </el-form-item> | 
 |  |  |         <el-form-item label="到场时间" prop="arriveDate"> | 
 |  |  |           <el-date-picker v-model="param.arriveDate" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" class="w300" | 
 |  |  |             placeholder="请选择"> | 
 |  |  |           <el-date-picker v-model="param.arriveDate" @change="checkSurplus" value-format="yyyy-MM-dd HH:mm:ss" | 
 |  |  |             type="datetime" class="w300" placeholder="请选择"> | 
 |  |  |           </el-date-picker> | 
 |  |  |         </el-form-item> | 
 |  |  |         <el-form-item label="入库类型" prop="inType"> | 
 |  |  | 
 |  |  |           </div> | 
 |  |  |         </el-form-item> | 
 |  |  |         <el-form-item label="总运输量" prop="totalNum"> | 
 |  |  |           <el-input oninput="value=value.replace(/^(0+)|[^\d]+/g, '').slice(0, 10)" v-model="param.totalNum" placeholder="请输入" class="w300"></el-input> | 
 |  |  |           <el-input @blur="checkSurplus" oninput="value=value.replace(/^(0+)|[^\d]+/g, '').slice(0, 10)" | 
 |  |  |             v-model="param.totalNum" placeholder="请输入" class="w300"></el-input> | 
 |  |  |           <span class="ml10">万支</span> | 
 |  |  |         </el-form-item> | 
 |  |  |         <el-form-item label="准运证照片" prop="transportImg"> | 
 |  |  | 
 |  |  |           <el-input v-model="param.driverName" placeholder="请输入" class="w300"></el-input> | 
 |  |  |         </el-form-item> | 
 |  |  |         <el-form-item label="司机手机号" prop="driverPhone"> | 
 |  |  |           <el-input oninput="value=value.replace(/^(0+)|[^\d]+/g, '').slice(0, 11)" v-model="param.driverPhone" placeholder="请输入" class="w300"></el-input> | 
 |  |  |           <el-input oninput="value=value.replace(/^(0+)|[^\d]+/g, '').slice(0, 11)" v-model="param.driverPhone" | 
 |  |  |             placeholder="请输入" class="w300"></el-input> | 
 |  |  |         </el-form-item> | 
 |  |  |         <el-form-item label="车前牌照号" prop="carCodeFront"> | 
 |  |  |           <el-input v-model="param.carCodeFront" placeholder="请输入" class="w300"></el-input> | 
 |  |  | 
 |  |  |       </el-form> | 
 |  |  |     </GlobalWindow> | 
 |  |  |     <!--  --> | 
 |  |  |     <DriverDetail v-if="isShowDriver" ref="DriverDetailRef" /> | 
 |  |  |     <DriverDetail v-if="isShowDriver" @success="getList" @close="isShowDriver = false" ref="DriverDetailRef" /> | 
 |  |  |   </div> | 
 |  |  | </template> | 
 |  |  |  | 
 |  |  | 
 |  |  | import Pagination from '@/components/common/Pagination' | 
 |  |  | import QueryForm from '@/components/common/QueryForm' | 
 |  |  | import { platformBooksPage, platformReasonList, platformBooksApply, platformBooksExport } from '@/api' | 
 |  |  | import DriverDetail from "@/views/task/driverDetail" | 
 |  |  | import { checkSurplusNum, deletebooksById } from '@/api/platform/platform' | 
 |  |  | import DriverDetail from '@/views/task/driverDetail' | 
 |  |  | import GlobalWindow from '@/components/common/GlobalWindow' | 
 |  |  | import UploadAvatarImage from '@/components/common/UploadAvatarImage' | 
 |  |  | import { Message } from 'element-ui' | 
 |  |  | import dayjs from 'dayjs' | 
 |  |  | import BaseComputHeight from "@/components/base/BaseComputHeight"; | 
 |  |  | export default { | 
 |  |  |   extends: BaseComputHeight, | 
 |  |  |   components: { | 
 |  |  |     Pagination, | 
 |  |  |     QueryForm, | 
 |  |  | 
 |  |  |     GlobalWindow, | 
 |  |  |     UploadAvatarImage | 
 |  |  |   }, | 
 |  |  |   data() { | 
 |  |  |   data () { | 
 |  |  |     return { | 
 |  |  |       isShowDriver: false, | 
 |  |  |       exLoading: false, | 
 |  |  | 
 |  |  |       rules: { | 
 |  |  |         contractNum: [{ required: true, message: '请输入', trigger: 'blur' }], | 
 |  |  |         totalNum: [{ required: true, message: '请输入', trigger: 'blur' }], | 
 |  |  |         driverName: [{ required: true, message: '请输入', trigger: 'blur' }], | 
 |  |  |         driverPhone: [{ required: true, message: '请输入', trigger: 'blur' }], | 
 |  |  |         carCodeFront: [{ required: true, message: '请输入', trigger: 'blur' }], | 
 |  |  |         carCodeBack: [{ required: true, message: '请输入', trigger: 'blur' }], | 
 |  |  | 
 |  |  |         reasonId: [{ required: true, message: '请选择', trigger: 'blur' }], | 
 |  |  |         arriveDate: [{ required: true, message: '请选择', trigger: 'blur' }], | 
 |  |  |         inType: [{ required: true, message: '请选择', trigger: 'blur' }], | 
 |  |  |         driverName: [{ required: true, message: '请选择', trigger: 'blur' }], | 
 |  |  |         driverName: [{ required: true, message: '请选择', trigger: 'blur' }] | 
 |  |  |       }, | 
 |  |  |       queryFormConfig: { | 
 |  |  |         formItems: [ | 
 |  |  | 
 |  |  |             label: '合同单号' | 
 |  |  |           }, | 
 |  |  |           { | 
 |  |  |             filed: 'status', | 
 |  |  |             type: 'select', | 
 |  |  |             label: '审批结果', | 
 |  |  |             options: [ | 
 |  |  |               { value: 0, label: '待审批' }, | 
 |  |  |               { value: 1, label: '审批中' }, | 
 |  |  |               { value: 2, label: '审批通过' }, | 
 |  |  |               { value: 3, label: '审批驳回' }, | 
 |  |  |               { value: 4, label: '已取消' } | 
 |  |  |             ] | 
 |  |  |           }, | 
 |  |  |           { | 
 |  |  |             filed: 'selDate', | 
 |  |  |             type: 'datetimerange', | 
 |  |  |             label: '操作时间', | 
 |  |  | 
 |  |  |           } | 
 |  |  |         ], | 
 |  |  |         online: true | 
 |  |  |       }, | 
 |  |  |       } | 
 |  |  |     } | 
 |  |  |   }, | 
 |  |  |   created() { | 
 |  |  |   created () { | 
 |  |  |     this.changeRadio('0') | 
 |  |  |     this.getList() | 
 |  |  |   }, | 
 |  |  |   methods: { | 
 |  |  |     checkSurplus () { | 
 |  |  |       const { arriveDate, reasonId, totalNum } = this.param | 
 |  |  |       if (!arriveDate || !reasonId || !totalNum) return | 
 |  |  |       checkSurplusNum({ | 
 |  |  |         arriveDate, | 
 |  |  |         reasonId, | 
 |  |  |         totalNum | 
 |  |  |       }).then(res => { | 
 |  |  |         console.log('res', res) | 
 |  |  |  | 
 |  |  |         if (res == 0 || res < Number(totalNum)) { | 
 |  |  |           Message.error(`当日剩余可预约作业量${res}万支不足请选择其他到场日期`) | 
 |  |  |         } | 
 |  |  |       }) | 
 |  |  |     }, | 
 |  |  |     changeRadio (day) { | 
 |  |  |       const arr = [dayjs().subtract(day, 'day').format('YYYY-MM-DD') + ' 00:00:00', dayjs().format('YYYY-MM-DD') + ' 23:59:59'] | 
 |  |  |       this.$set(this.filters, 'selDate', arr) | 
 |  |  | 
 |  |  |         this.getList() | 
 |  |  |       } | 
 |  |  |     }, | 
 |  |  |     getList(page) { | 
 |  |  |     getList (page) { | 
 |  |  |       const { pagination, filters } = this | 
 |  |  |       this.loading = true | 
 |  |  |       platformBooksPage({ | 
 |  |  |         model: { | 
 |  |  |           ...filters, | 
 |  |  |           arriveDateStart: filters.selDate && filters.selDate.length > 0 ? filters.selDate[0] : null, | 
 |  |  |           arriveDateEnd: filters.selDate && filters.selDate.length > 0 ? filters.selDate[1] : null, | 
 |  |  |           arriveDateEnd: filters.selDate && filters.selDate.length > 0 ? filters.selDate[1] : null | 
 |  |  |         }, | 
 |  |  |         capacity: pagination.pageSize, | 
 |  |  |         page: page || pagination.page, | 
 |  |  |         page: page || pagination.page | 
 |  |  |       }).then(res => { | 
 |  |  |         this.loading = false | 
 |  |  |         this.list = res.records || [] | 
 |  |  | 
 |  |  |         this.loading = false | 
 |  |  |       }) | 
 |  |  |     }, | 
 |  |  |     handleEx() { | 
 |  |  |     handleEx () { | 
 |  |  |       this.$dialog.exportConfirm('确认导出吗?') | 
 |  |  |         .then(() => { | 
 |  |  |           const { filters } = this | 
 |  |  |           this.exLoading = true | 
 |  |  |           platformBooksExport({ | 
 |  |  |             page: this.pagination.page, | 
 |  |  |             capacity: 1000000, | 
 |  |  |             model: this.filters | 
 |  |  |             model: { | 
 |  |  |               ...filters, | 
 |  |  |               arriveDateStart: filters.selDate && filters.selDate.length > 0 ? filters.selDate[0] : null, | 
 |  |  |               arriveDateEnd: filters.selDate && filters.selDate.length > 0 ? filters.selDate[1] : null | 
 |  |  |             } | 
 |  |  |           }) | 
 |  |  |             .then(response => { | 
 |  |  |               this.download(response) | 
 |  |  | 
 |  |  |             }) | 
 |  |  |         }) | 
 |  |  |     }, | 
 |  |  |     onSubmit() { | 
 |  |  |       this.$refs['ruleForm'].validate((valid) => { | 
 |  |  |     onSubmit () { | 
 |  |  |       this.$refs.ruleForm.validate((valid) => { | 
 |  |  |         const param = this.param | 
 |  |  |         param.inReason = this.reasonList.find(item => param.reasonId == item.id).reason | 
 |  |  |         if (valid) { | 
 |  |  |           this.subLoading = true | 
 |  |  |           platformBooksApply({ ...param }).then(res => { | 
 |  |  |             this.getList() | 
 |  |  |             this.subLoading = false | 
 |  |  |             this.isShowEdit = false | 
 |  |  |           }, () => { | 
 |  |  |             this.subLoading = false | 
 |  |  |           }) | 
 |  |  |         } | 
 |  |  |       }) | 
 |  |  |     }, | 
 |  |  |     uploadSuccess(file) { | 
 |  |  |     uploadSuccess (file) { | 
 |  |  |       this.$set(this.param, 'transportImg', file.imgurl) | 
 |  |  |       this.$set(this.param, 'transportImgFull', file.imgurlfull) | 
 |  |  |     }, | 
 |  |  |     handleEdit(row) { | 
 |  |  |     handleEdit (row) { | 
 |  |  |       this.isShowEdit = true | 
 |  |  |       this.param = { | 
 |  |  |         inType: 0 | 
 |  |  |       } | 
 |  |  |       this.$nextTick(() => { | 
 |  |  |         this.$refs['ruleForm'].clearValidate() | 
 |  |  |         this.$refs.ruleForm.clearValidate() | 
 |  |  |       }) | 
 |  |  |       this.$set(this.param, 'arriveDate', dayjs().format('YYYY-MM-DD HH:mm:ss')) | 
 |  |  |       this.getplatformReason() | 
 |  |  |     }, | 
 |  |  |     getplatformReason() { | 
 |  |  |     getplatformReason () { | 
 |  |  |       platformReasonList().then(res => { | 
 |  |  |         this.reasonList = res || [] | 
 |  |  |       }) | 
 |  |  |     }, | 
 |  |  |     handleSub() { | 
 |  |  |     handleSub () { | 
 |  |  |       this.$refs.ruleForm.validate((valid) => { | 
 |  |  |         if (valid) { | 
 |  |  |           alert('submit!') | 
 |  |  |         } | 
 |  |  |       }) | 
 |  |  |     }, | 
 |  |  |     clear() { | 
 |  |  |     clear () { | 
 |  |  |       this.pagination.page = 1 | 
 |  |  |       this.filters = { | 
 |  |  |         selDate: [], | 
 |  |  |         fastdate: 0, | 
 |  |  |         selDate: [] | 
 |  |  |       } | 
 |  |  |       this.getList() | 
 |  |  |       // this.changeRadio('0') | 
 |  |  |     }, | 
 |  |  |     handleDetail(row) { | 
 |  |  |     handleDetail (row) { | 
 |  |  |       this.isShowDriver = true | 
 |  |  |       this.$nextTick(() => { | 
 |  |  |         this.$refs.DriverDetailRef.id = row.id | 
 |  |  | 
 |  |  |         this.$refs.DriverDetailRef.isShowModal = true | 
 |  |  |       }) | 
 |  |  |     }, | 
 |  |  |     handleDel() { }, | 
 |  |  |     handleSizeChange(capacity) { | 
 |  |  |     handleDel (row) { | 
 |  |  |       this.$confirm('确定删除该记录吗, 是否继续?', '提示', { | 
 |  |  |         confirmButtonText: '确定', | 
 |  |  |         cancelButtonText: '取消', | 
 |  |  |         type: 'warning' | 
 |  |  |       }).then(() => { | 
 |  |  |         deletebooksById(row.id) | 
 |  |  |           .then(res => { | 
 |  |  |             this.$message.success('操作成功') | 
 |  |  |             this.page = 1 | 
 |  |  |             this.getList() | 
 |  |  |           }) | 
 |  |  |       }).catch(() => { | 
 |  |  |       }) | 
 |  |  |     }, | 
 |  |  |     handleSizeChange (capacity) { | 
 |  |  |       this.pagination.pageSize = capacity | 
 |  |  |       this.getList() | 
 |  |  |     } | 
 |  |  |   } | 
 |  |  | } | 
 |  |  | 
 |  |  |   color: #000000; | 
 |  |  |   margin-bottom: 15px; | 
 |  |  | } | 
 |  |  | </style> | 
 |  |  | </style> |