|  |  |  | 
|---|
|  |  |  | <div class="pt16"> | 
|---|
|  |  |  | <el-button type="primary" @click="handleEdit" icon="el-icon-plus" | 
|---|
|  |  |  | v-permissions="['business:platformbooks:create']">新建</el-button> | 
|---|
|  |  |  | <el-button type="primary" @click="complete(ids)">完成作业</el-button> | 
|---|
|  |  |  | <el-button :loading="exLoading" @click="handleEx" | 
|---|
|  |  |  | v-permissions="['business:platformbooks:exportExcel']">导出</el-button> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <el-table class="mb40" v-loading="loading" :data="list" stripe> | 
|---|
|  |  |  | <el-table-column prop="contractNum" label="合同单号" min-width="100" show-overflow-tooltip /> | 
|---|
|  |  |  | <el-table :height="tableHeightNew" v-loading="loading" :data="list" @selection-change="handleSelectionChange" stripe> | 
|---|
|  |  |  | <el-table-column type="selection" width="55"></el-table-column> | 
|---|
|  |  |  | <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="carCodeFront" label="车牌前照号" min-width="100" show-overflow-tooltip /> | 
|---|
|  |  |  | <el-table-column prop="carCodeBack" label="车牌后照号" min-width="100" show-overflow-tooltip /> | 
|---|
|  |  |  | <el-table-column prop="driverName" 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="inTypeTemp" label="作业类型" min-width="100" show-overflow-tooltip /> | 
|---|
|  |  |  | <el-table-column label="作业状态" min-width="100" show-overflow-tooltip> | 
|---|
|  |  |  | <template v-slot="scope"> | 
|---|
|  |  |  | <span v-if="[2,3,4].includes(scope.row.status)">{{ statusMap[scope.row.jobStatus] || '' }}</span> | 
|---|
|  |  |  | <span v-else>-</span> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  | </el-table-column> | 
|---|
|  |  |  | <el-table-column prop="arriveDate" label="预约到场时间" min-width="150" show-overflow-tooltip /> | 
|---|
|  |  |  | <el-table-column label="审批结果" min-width="100" show-overflow-tooltip> | 
|---|
|  |  |  | <template v-slot="scope"> | 
|---|
|  |  |  | 
|---|
|  |  |  | </el-table-column> | 
|---|
|  |  |  | <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> | 
|---|
|  |  |  | <el-table-column prop="editUserName" label="最后操作人员" min-width="150" show-overflow-tooltip /> | 
|---|
|  |  |  | <el-table-column prop="name" label="操作" min-width="170" 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> | 
|---|
|  |  |  | <el-button type="text" @click="complete([scope.row.jobId])" v-if="[0,1,2].includes(scope.row.jobStatus)">完成作业</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-option> | 
|---|
|  |  |  | </el-select> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | <el-form-item label="合同号" prop="contractNum"> | 
|---|
|  |  |  | <el-input v-model="param.contractNum" class="w300" placeholder="请输入合同号"></el-input> | 
|---|
|  |  |  | <el-form-item label="合同/单据编号" prop="contractNum"> | 
|---|
|  |  |  | <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" @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"> | 
|---|
|  |  |  | <el-form-item label="作业类型" prop="inType"> | 
|---|
|  |  |  | <div> | 
|---|
|  |  |  | <el-radio v-model="param.inType" :label="0">整件盘</el-radio> | 
|---|
|  |  |  | <el-radio v-model="param.inType" :label="1">件烟</el-radio> | 
|---|
|  |  |  | 
|---|
|  |  |  | v-model="param.totalNum" placeholder="请输入" class="w300"></el-input> | 
|---|
|  |  |  | <span class="ml10">万支</span> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | <el-form-item label="准运证照片" prop="transportImg"> | 
|---|
|  |  |  | <el-form-item label="准运证/运单照片" prop="transportImg"> | 
|---|
|  |  |  | <UploadAvatarImage :file="{ 'imgurlfull': param.transportImgFull, 'imgurl': param.transportImg }" | 
|---|
|  |  |  | :uploadData="{ folder: 'platform' }" @uploadSuccess="uploadSuccess" @uploadEnd="isUploading = false" | 
|---|
|  |  |  | @uploadBegin="isUploading = true" /> | 
|---|
|  |  |  | 
|---|
|  |  |  | <script> | 
|---|
|  |  |  | import Pagination from '@/components/common/Pagination' | 
|---|
|  |  |  | import QueryForm from '@/components/common/QueryForm' | 
|---|
|  |  |  | import { platformBooksPage, platformReasonList, platformBooksApply, platformBooksExport } from '@/api' | 
|---|
|  |  |  | import { platformBooksPage, platformReasonList, platformBooksApply, platformBooksExport, dealJobFinish } from '@/api' | 
|---|
|  |  |  | 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 { statusMap } from '../config' | 
|---|
|  |  |  | import dayjs from 'dayjs' | 
|---|
|  |  |  | import BaseComputHeight from "@/components/base/BaseComputHeight" | 
|---|
|  |  |  | export default { | 
|---|
|  |  |  | extends: BaseComputHeight, | 
|---|
|  |  |  | components: { | 
|---|
|  |  |  | Pagination, | 
|---|
|  |  |  | QueryForm, | 
|---|
|  |  |  | 
|---|
|  |  |  | GlobalWindow, | 
|---|
|  |  |  | UploadAvatarImage | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | data () { | 
|---|
|  |  |  | data() { | 
|---|
|  |  |  | return { | 
|---|
|  |  |  | statusMap, | 
|---|
|  |  |  | isShowDriver: false, | 
|---|
|  |  |  | exLoading: false, | 
|---|
|  |  |  | loading: false, | 
|---|
|  |  |  | 
|---|
|  |  |  | total: 0 | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | filters: { | 
|---|
|  |  |  | selDate: [], | 
|---|
|  |  |  | arriveDateStart: '', | 
|---|
|  |  |  | arriveDateEnd: '', | 
|---|
|  |  |  | fastdate: 0 | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | list: [], | 
|---|
|  |  |  | 
|---|
|  |  |  | label: '合同单号' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | filed: 'jobStatus', | 
|---|
|  |  |  | type: 'select', | 
|---|
|  |  |  | label: '作业状态', | 
|---|
|  |  |  | options: [ | 
|---|
|  |  |  | { value: 0, label: '待确认' }, | 
|---|
|  |  |  | { value: 1, label: '待签到' }, | 
|---|
|  |  |  | { value: 2, label: '等待叫号' }, | 
|---|
|  |  |  | { value: 3, label: '入园等待' }, | 
|---|
|  |  |  | { value: 4, label: '月台等待' }, | 
|---|
|  |  |  | { value: 5, label: '作业中' }, | 
|---|
|  |  |  | { value: 6, label: '作业完成' }, | 
|---|
|  |  |  | { value: 7, label: '转移中' }, | 
|---|
|  |  |  | { value: 8, label: '异常挂起' }, | 
|---|
|  |  |  | { value: 9, label: '已授权离园' }, | 
|---|
|  |  |  | // { value: 10, label: '已离园' }, | 
|---|
|  |  |  | { value: 11, label: '已过号' }, | 
|---|
|  |  |  | { value: 12, label: '已取消' }, | 
|---|
|  |  |  | ] | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | filed: 'status', | 
|---|
|  |  |  | type: 'select', | 
|---|
|  |  |  | label: '审批结果', | 
|---|
|  |  |  | 
|---|
|  |  |  | ] | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | filed: 'selDate', | 
|---|
|  |  |  | type: 'datetimerange', | 
|---|
|  |  |  | label: '操作时间', | 
|---|
|  |  |  | pickerOptions: {} | 
|---|
|  |  |  | filed: 'reasonId', | 
|---|
|  |  |  | type: 'select', | 
|---|
|  |  |  | label: '入园原因', | 
|---|
|  |  |  | options: [] | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | filed1: 'arriveDateStart', | 
|---|
|  |  |  | filed2: 'arriveDateEnd', | 
|---|
|  |  |  | type: 'datetime', | 
|---|
|  |  |  | label: '预约到场时间' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | type: 'slot', | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ], | 
|---|
|  |  |  | online: true | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | ids: [] | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | created () { | 
|---|
|  |  |  | created() { | 
|---|
|  |  |  | this.changeRadio('0') | 
|---|
|  |  |  | this.getList() | 
|---|
|  |  |  | this.getplatformReasons() | 
|---|
|  |  |  | // this.getList() | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | methods: { | 
|---|
|  |  |  | checkSurplus () { | 
|---|
|  |  |  | handleSelectionChange(ids) { | 
|---|
|  |  |  | this.ids = ids.map(item => item.jobId) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | complete(ids) { | 
|---|
|  |  |  | var that = this; | 
|---|
|  |  |  | if (ids.length === 0) { | 
|---|
|  |  |  | return this.$message.warning('至少选择一项内容') | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.$confirm('是否确认完成作业?, 是否确认?', '提示', { | 
|---|
|  |  |  | confirmButtonText: '确认', | 
|---|
|  |  |  | cancelButtonText: '取消', | 
|---|
|  |  |  | type: 'warning' | 
|---|
|  |  |  | }).then(() => { | 
|---|
|  |  |  | dealJobFinish(ids) | 
|---|
|  |  |  | .then(res => { | 
|---|
|  |  |  | that.getList() | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }).catch(() => { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | checkSurplus() { | 
|---|
|  |  |  | const { arriveDate, reasonId, totalNum } = this.param | 
|---|
|  |  |  | if (!arriveDate || !reasonId || !totalNum) return | 
|---|
|  |  |  | checkSurplusNum({ | 
|---|
|  |  |  | 
|---|
|  |  |  | reasonId, | 
|---|
|  |  |  | totalNum | 
|---|
|  |  |  | }).then(res => { | 
|---|
|  |  |  | console.log('res', res) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (res == 0 || res < Number(totalNum)) { | 
|---|
|  |  |  | Message.error(`当日剩余可预约作业量${res}万支不足请选择其他到场日期`) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | changeRadio (day) { | 
|---|
|  |  |  | 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.filters.arriveDateStart = arr[0] | 
|---|
|  |  |  | this.filters.arriveDateEnd = arr[1] | 
|---|
|  |  |  | this.getList(1) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | changeForm(str) { | 
|---|
|  |  |  | if (this.filters.arriveDateStart > this.filters.arriveDateEnd) { | 
|---|
|  |  |  | this.filters.arriveDateStart = this.filters.arriveDateEnd | 
|---|
|  |  |  | return this.$message.error('开始时间不能大于结束时间') | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.getList() | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | changeForm (str) { | 
|---|
|  |  |  | if (str === 'selDate') { | 
|---|
|  |  |  | this.$set(this.filters, 'fastdate', null) | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | ...filters | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | capacity: pagination.pageSize, | 
|---|
|  |  |  | page: page || pagination.page | 
|---|
|  |  |  | 
|---|
|  |  |  | this.loading = false | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | handleEx () { | 
|---|
|  |  |  | handleEx() { | 
|---|
|  |  |  | this.$dialog.exportConfirm('确认导出吗?') | 
|---|
|  |  |  | .then(() => { | 
|---|
|  |  |  | const { filters } = this | 
|---|
|  |  |  | 
|---|
|  |  |  | page: this.pagination.page, | 
|---|
|  |  |  | capacity: 1000000, | 
|---|
|  |  |  | model: { | 
|---|
|  |  |  | ...filters, | 
|---|
|  |  |  | arriveDateStart: filters.selDate && filters.selDate.length > 0 ? filters.selDate[0] : null, | 
|---|
|  |  |  | arriveDateEnd: filters.selDate && filters.selDate.length > 0 ? filters.selDate[1] : null | 
|---|
|  |  |  | ...filters | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | .then(response => { | 
|---|
|  |  |  | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | onSubmit () { | 
|---|
|  |  |  | onSubmit() { | 
|---|
|  |  |  | this.$refs.ruleForm.validate((valid) => { | 
|---|
|  |  |  | const param = this.param | 
|---|
|  |  |  | param.inReason = this.reasonList.find(item => param.reasonId == item.id).reason | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | 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.$set(this.param, 'arriveDate', dayjs().format('YYYY-MM-DD HH:mm:ss')) | 
|---|
|  |  |  | this.getplatformReason() | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | getplatformReason () { | 
|---|
|  |  |  | getplatformReason() { | 
|---|
|  |  |  | platformReasonList().then(res => { | 
|---|
|  |  |  | this.reasonList = res || [] | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | handleSub () { | 
|---|
|  |  |  | getplatformReasons() { | 
|---|
|  |  |  | platformReasonList().then(res => { | 
|---|
|  |  |  | this.queryFormConfig.formItems[5].options = (res || []).map(item => { | 
|---|
|  |  |  | return { | 
|---|
|  |  |  | value: item.id, | 
|---|
|  |  |  | label: item.reason | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | handleSub() { | 
|---|
|  |  |  | this.$refs.ruleForm.validate((valid) => { | 
|---|
|  |  |  | if (valid) { | 
|---|
|  |  |  | alert('submit!') | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | clear () { | 
|---|
|  |  |  | clear() { | 
|---|
|  |  |  | this.pagination.page = 1 | 
|---|
|  |  |  | this.filters = { | 
|---|
|  |  |  | selDate: [] | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.filters = {} | 
|---|
|  |  |  | 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 (row) { | 
|---|
|  |  |  | handleDel(row) { | 
|---|
|  |  |  | this.$confirm('确定删除该记录吗, 是否继续?', '提示', { | 
|---|
|  |  |  | confirmButtonText: '确定', | 
|---|
|  |  |  | cancelButtonText: '取消', | 
|---|
|  |  |  | 
|---|
|  |  |  | }).catch(() => { | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | handleSizeChange (capacity) { | 
|---|
|  |  |  | handleSizeChange(capacity) { | 
|---|
|  |  |  | this.pagination.pageSize = capacity | 
|---|
|  |  |  | this.getList() | 
|---|
|  |  |  | this.getList(1) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|