You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

1842 lines
49 KiB

<template>
<basic-container>
<div class="avue-crud" v-loading="details.loadingObj.pageLoading">
<!-- 搜索模块 -->
<div v-h5uShow="!search">
<!-- 查询模块 -->
<el-form :inline="true" :model="query" class="header_search">
<el-form-item label="扫码时间:" class="el-times">
<el-date-picker
v-model="details.query.createTimeArr"
type="daterange"
unlink-panels
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
value-format="YYYY-MM-DD"
:shortcuts="shortcuts"
clearable
/>
</el-form-item>
<el-form-item label="卸车时间:" class="el-times">
<el-date-picker
v-model="details.query.unloadTimeArr"
type="daterange"
unlink-panels
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
value-format="YYYY-MM-DD"
:shortcuts="shortcuts"
clearable
/>
</el-form-item>
<!-- 查询按钮 -->
<el-form-item class="el-btn">
<el-button type="primary" icon="el-icon-search" @click="searchChange">搜 索</el-button>
<el-button icon="el-icon-delete" @click="searchReset">清 空</el-button>
</el-form-item>
</el-form>
</div>
<!-- 控件模块 -->
<div class="avue-crud__header">
<!-- 头部左侧按钮模块 -->
<div class="avue-crud__left">
<el-button
v-if="permissionObj.truckLoadingDetails_changePlanWarehouse"
type="primary"
icon="Edit"
@click="handleChooseWarehouse"
>
计划仓更改
</el-button>
<!-- 中转批量签收 -->
<el-button
v-if="permissionObj.truckLoadingDetails_batchSign"
type="primary"
icon="Edit"
@click="handleBatchSigin"
>
中转批量签收
</el-button>
<!-- 批量卸车 -->
<el-button
v-if="permissionObj.truckLoadingDetails_batchUnload"
type="primary"
icon="List"
@click="handleBatchUnLoad"
>
批量卸车
</el-button>
<!-- 删除 -->
<el-button
v-if="permissionObj.truckLoadingDetails_delete"
type="primary"
icon="Delete"
@click="handleBatchRemove"
>删除
</el-button>
<!-- 零担批量卸车确认 -->
<el-button
v-if="permissionObj.truckLoadingDetails_zeroUnload"
type="primary"
icon="CircleCheck"
@click="handleBatchLoadConfirm"
>零担批量卸车确认
</el-button>
<!-- 二维码 -->
<el-button type="primary" icon="Printer" @click="handleBatchBarcode">二维码</el-button>
<!-- 导出 -->
<el-button type="primary" icon="Download" @click="handleExport">导出</el-button>
</div>
<!-- 头部右侧按钮模块 -->
<div class="avue-crud__right">
<el-button icon="el-icon-refresh" @click="searchChange" circle></el-button>
<el-button icon="Operation" @click="showdrawer(true)" circle></el-button>
<el-button icon="el-icon-search" @click="searchHide" circle></el-button>
</div>
</div>
<!-- 列表模块 -->
<tablecmt
ref="tableNodeRef"
:columnList="details.detailsColumnList"
:tableData="data"
:loading="loadingObj.list"
@inputTxt="inputsc"
@timeCheck="timesc"
@btnCheck="btnsc"
@selectCheck="selectsc"
@selection="selectionChange"
:tableRowClassName="
(row, index) => {
if (row.loadingAbnormal || row.unloadAbnormal) return 'Abnormal';
else return '';
}
"
>
<template #default="slotProps">
<!-- 装卸状态 -->
<template v-if="slotProps.scope.column.label === '装卸状态'">
<el-tag
:class="{
sub: Number(slotProps.scope.row.scanStatus) === 1,
err:
Number(slotProps.scope.row.scanStatus) === 2 ||
Number(slotProps.scope.row.scanStatus) === 4,
primary: Number(slotProps.scope.row.scanStatus) === 3,
}"
>
{{ slotProps.scope.row.scanStatusName }}
</el-tag>
</template>
<!-- 操作 -->
<template v-else-if="slotProps.scope.column.label === '操作'">
<!-- 零担 -->
<template v-if="Number(slotProps.scope.row.type) === 2">
<el-text
type="text"
@click="() => handleZeroUnLoad(slotProps.scope, 'unload')"
v-if="
permissionObj.truckLoadingDetails_zeroUnload &&
details.pageInfo.type !== 'VehicleStowage' &&
// 卸车确认
Number(slotProps.scope.row.unloadCheck) === 0 &&
// 签收状态
Number(slotProps.scope.row.scanStatus) !== 3 &&
// 三方送货方式为送货, 发车后不允许卸车
(Number($route.query.deliveryType) === 2
? Number($route.query.loadStatus) === 0
: true)
"
>
零担卸车
</el-text>
<el-text type="text" @click="() => handleZeroUnLoad(slotProps.scope, 'view')">
零担详情
</el-text>
<!-- 零担二维码 -->
<el-text @click="() => printOrderByZero(slotProps.scope)">零担二维码</el-text>
</template>
<!-- 包件 -->
<template v-else-if="Number(slotProps.scope.row.type) === 1">
<el-text
type="text"
@click="handleOrderUnLoad(slotProps.scope)"
v-if="
permissionObj.truckLoadingDetails_packageUnload &&
details.pageInfo.type !== 'VehicleStowage' &&
Number(slotProps.scope.row.scanStatus) === 1 &&
Number(slotProps.scope.row.unloadCheck) === 0
"
>
包件卸车
</el-text>
<el-text @click="printOrder(slotProps.scope)"> 二维码 </el-text>
</template>
</template>
</template>
</tablecmt>
<!-- 分页模块 -->
<div class="avue-crud__pagination flex-c-sb" style="width: 100%">
<div style="font-size: 14px">勾选数量: {{ selectionList.length }}</div>
<!-- 分页模块 -->
<el-pagination
align="right"
background
@size-change="sizeChange"
@current-change="currentChange"
:current-page="page.pageNum"
:page-sizes="[30, 50, 80, 120, 500]"
:page-size="page.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="page.total"
>
</el-pagination>
</div>
</div>
</basic-container>
<!-- 零担卸车 -->
<el-dialog
:title="details.zeroItem.type === 'unload' ? '零担卸车' : '零担详情'"
v-model="details.popUpShow.transferVisited"
width="40%"
append-to-body
class="truckLoadingDetailPopUp"
>
<div class="editZeroCategoryTitleRowByLine">订单信息</div>
<div class="editZeroCategoryTitleRow mt10">
<div class="title">
<span>运单号:</span>
<span>{{ details.zeroItem.waybillNo }}</span>
</div>
<div class="title">
<span>订单号:</span>
<span>{{ details.zeroItem.orderCode }}</span>
</div>
<div class="title">
<span>装车数:</span>
<span>{{ details.zeroItem.num }}</span>
</div>
<div class="title">
<span>卸车数:</span>
<span>{{ details.zeroItem.unloadNum }}</span>
</div>
</div>
<!-- 品类详情 -->
<div class="editZeroCategoryTitleRowByLine mt10">品类详情</div>
<!-- 列表 -->
<div class="editZeroCategoryList">
<!-- 子项 -->
<div
class="editZeroCategoryList_item"
v-for="item in details.zeroItem.zeroPackageSupplyVOS"
:key="item.packageId"
>
<!-- 标题行 -->
<div class="editZeroCategoryTitleRow">
<div class="title">
<span>品类名:</span>
<span>{{ item.goodsName }}</span>
</div>
<div class="title">
<span>装车数:</span>
<span>{{ item.loadingNum }}</span>
</div>
<div class="title">
<span>已卸数:</span>
<span>{{ item.unloadNum }}</span>
</div>
</div>
<template v-if="details.zeroItem.type === 'unload'">
<el-input-number
class="inputNum mt10 w100"
v-model="item.enterNum"
controls-position="right"
:precision="0"
:min="0"
:max="item.stockNum"
:step="1"
:value-on-clear="0"
:controls="false"
/>
</template>
</div>
</div>
<!-- <el-form-item label="零担卸车数量" label-width="100px">
<el-input-number
style="width: 100%"
:precision="0"
:max="details.zeroItem.num"
:min="0"
:controls="false"
v-model="details.zeroItem.enterNum"
/>
</el-form-item> -->
<!-- 表单按钮 -->
<div class="flex-c-c" v-if="details.zeroItem.type === 'unload'">
<el-button icon="Close" @click="details.popUpShow.transferVisited = false"> 取 消 </el-button>
<el-button type="primary" icon="Position" @click="handleZeroUnLoadSubmit"> 提 交 </el-button>
</div>
</el-dialog>
<!-- 打印二维码 -->
<MyPrint
:html="details.html"
v-model="details.popUpShow.QRCodeVisible"
width="780px"
type="titlePrint"
:isShowExport="false"
/>
<!-- 配置装车目的地 -->
<el-dialog
title="配置装车目的地"
v-model="details.popUpShow.chooseDestinationVisited"
width="30%"
append-to-body
class="truckLoadingDetailPopUp"
>
<el-form-item label="目的地" prop="region">
<el-select v-model="details.chooseNodeId" placeholder="请选择目的地" class="w100">
<el-option
v-for="item in details.nextNodeData"
:key="item"
:label="item.warehouseName"
:value="item.warehouseId"
/>
</el-select>
</el-form-item>
<!-- 表单按钮 -->
<template #footer>
<div class="dialog-footer">
<el-button
icon="el-icon-circle-close"
@click="details.popUpShow.chooseDestinationVisited = false"
>取 消</el-button
>
<el-button type="primary" icon="el-icon-circle-check" @click="handleEditSubmit">
确 认
</el-button>
</div>
</template>
</el-dialog>
<!-- 列表配置显示 -->
<edittablehead
@closce="showdrawer"
:drawerShow="drawerShow"
:columnList="details.detailsColumnList"
v-model="details.detailsColumnList"
></edittablehead>
</template>
<script lang="ts">
export default {
name: '/distribution/artery/truckLoadingDetails',
};
</script>
<script setup lang="ts">
import { ref, reactive, toRefs, computed, onMounted, nextTick, watch } from 'vue';
import functions from '@/utils/functions';
import dayjs from 'dayjs';
import { mapGetters, useStore } from 'vuex';
import { ElMessage, ElMessageBox } from 'element-plus';
import type { Action } from 'element-plus';
import { getMyCurrentWarehouse } from '@/api/work/work';
import {
postLoadingDetail,
postBatchUnload,
postTransferUnloadPackage,
postTransferUnloadZero,
postBatchTransferUnload,
postRemoveCarsLoadScan,
postSignLoadScanByIds,
postLoadingDetailExport,
postShowOrderCodeByCode,
postFindZeroDetailByCarsLoadScanId,
postUnloadZero,
postZeroUnloadEnter,
} from '@/api/distribution/truckLoadingDetails';
import {
postFindNextNodeList,
postUpdateLoadScanFinalNodeIdById,
} from '@/api/distribution/VehicleStowage';
import { getShowAdvancePackgeCode } from '@/api/waybill/orderPackageListDetails';
/** 获取字典 */
import { getDictionaryBiz } from '@/api/system/dict';
import {
downloadXls,
getHtmls,
debounce,
setNodeHeight,
deepClone,
handleClearTableQuery,
getObjType,
ChecksWhetherTheWarehouseIsSelected,
isNumber,
} from '@/utils/util';
import { detailsColumnList } from '@/option/distribution/TripartiteTransfer';
import { useRouter, useRoute } from 'vue-router';
const details = reactive<any>({
/** 是否开启搜索 */
search: true,
/** 表格搜索条件 */
query: {},
/** 时间快捷选择设置 */
shortcuts: [
{
text: '最近一周',
value: () => {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
return [start, end];
},
},
{
text: '最近一个月',
value: () => {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
return [start, end];
},
},
{
text: '最近三个月',
value: () => {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
return [start, end];
},
},
],
/** 装车明细表头信息 */
detailsColumnList: deepClone(detailsColumnList),
/** 列表数据 */
data: [],
/** 页面loading */
loadingObj: {
/** 列表加载loading */
list: false,
/** 页面loading */
pageLoading: false,
/** 查看二维码 */
QRCodeVisible: false,
},
/** 列表复选框选中的数据 */
selectionList: [],
/** 是否显示设置表格 */
drawerShow: false,
/** 分页参数 */
page: {
pageNum: 1,
pageSize: 30,
total: 0,
},
/** 弹出层显示 */
popUpShow: {
/** 零担补录 */
transferVisited: false,
/** 计划仓更改 */
chooseDestinationVisited: false,
},
/** 列表Dom节点 */
listNode: '',
form: {},
/** 页面数据 */
pageInfo: {
/** 配送ID */
loadId: '',
/** 页面类型
* TripartiteTransfer -- 三方中转
* VehicleStowage -- 车辆配载
* */
type: '',
},
/** 被选中的零担数据 */
zeroItem: {},
// 字典
/** 装卸状态 */
scanStatusOption: [
{ label: '装车', value: 1 },
{ label: '卸车', value: 2 },
{ label: '签收', value: 3 },
{ label: '滞留', value: 4 },
],
/** 有无数据 */
isDataOption: [
{ label: '有数据', value: 1 },
{ label: '无数据', value: 0 },
],
/** 类型 */
typeOption: [
{ label: '包件', value: 1 },
{ label: '零担', value: 2 },
],
/** 是否装车异常 */
loadingAbnormalOption: [
{ label: '是', value: 1 },
{ label: '否', value: 0 },
],
/** 是否卸车异常 */
unloadAbnormalOption: [
{ label: '是', value: 1 },
{ label: '否', value: 0 },
],
/** 是否补录 */
isSuppleOption: [
{ label: '是', value: 1 },
{ label: '否', value: 0 },
],
/** 个人仓库信息 */
myWarehouseData: {},
/** 打印的二维码 */
html: '',
/** 后续节点仓库数据 */
nextNodeData: [],
choosePackageList: [],
chooseNodeId: '',
});
const {
search,
query,
shortcuts,
data,
loadingObj,
selectionList,
drawerShow,
page,
trickleLoadingPage,
} = toRefs(details);
// 获取路由实例
const $router = useRouter();
const $route = useRoute();
// vuex
const $store = useStore();
/** vuex */
const permission = computed(() => mapGetters(['permission', 'tagWel', 'tagList']));
/** 权限按钮 */
const permissionObj = reactive({
// VehicleStowage -- 车辆配载; VehicleArrivalManagement -- 到车管理; TripartiteTransfer -- 三方中转
/** 计划仓更改 */
truckLoadingDetails_changePlanWarehouse: computed(() => {
let _flag = false;
switch (details.pageInfo.type) {
case 'VehicleStowage':
_flag = $store.getters.permission.truckLoadingDetails_VehicleStowage_changePlanWarehouse;
break;
default:
break;
}
return _flag;
}),
/** 中转批量签收 */
truckLoadingDetails_batchSign: computed(() => {
let _flag = false;
switch (details.pageInfo.type) {
case 'TripartiteTransfer':
_flag = $store.getters.permission.truckLoadingDetails_TripartiteTransfer_BatchSigin;
break;
default:
break;
}
return _flag;
}),
/** 批量卸车 */
truckLoadingDetails_batchUnload: computed(() => {
let _flag = false;
switch (details.pageInfo.type) {
case 'VehicleArrivalManagement':
_flag = $store.getters.permission.truckLoadingDetails_VehicleArrivalManagement_batchUnload;
break;
case 'TripartiteTransfer':
_flag = $store.getters.permission.truckLoadingDetails_TripartiteTransfer_batchUnload;
break;
default:
break;
}
return _flag;
}),
/** 删除 */
truckLoadingDetails_delete: computed(() => {
let _flag = false;
switch (details.pageInfo.type) {
case 'VehicleStowage':
_flag = $store.getters.permission.truckLoadingDetails_VehicleStowage_delete;
break;
case 'VehicleArrivalManagement':
_flag = $store.getters.permission.truckLoadingDetails_VehicleArrivalManagement_delete;
break;
case 'TripartiteTransfer':
_flag = $store.getters.permission.truckLoadingDetails_TripartiteTransfer_delete;
break;
default:
break;
}
return _flag;
}),
/** 零担卸车 */
truckLoadingDetails_zeroUnload: computed(() => {
let _flag = false;
switch (details.pageInfo.type) {
case 'VehicleStowage':
_flag = $store.getters.permission.truckLoadingDetails_VehicleStowage_zeroUnload;
break;
case 'VehicleArrivalManagement':
_flag = $store.getters.permission.truckLoadingDetails_VehicleArrivalManagement_zeroUnload;
break;
case 'TripartiteTransfer':
_flag = $store.getters.permission.truckLoadingDetails_TripartiteTransfer_zeroUnload;
break;
default:
break;
}
return _flag;
}),
/** 包件卸车 */
truckLoadingDetails_packageUnload: computed(() => {
let _flag = false;
switch (details.pageInfo.type) {
case 'VehicleStowage':
_flag = $store.getters.permission.truckLoadingDetails_VehicleStowage_packageUnload;
break;
case 'VehicleArrivalManagement':
_flag =
$store.getters.permission.truckLoadingDetails_VehicleArrivalManagement_packageUnload;
break;
case 'TripartiteTransfer':
_flag = $store.getters.permission.truckLoadingDetails_TripartiteTransfer_packageUnload;
break;
default:
break;
}
return _flag;
}),
});
console.log('permission :>> ', permission);
// 表格实例
const tableNodeRef = ref();
/** 初始化表格表头 */
const initTableSelect = () => {
for (const iterator of details.detailsColumnList) {
iterator.checkarr = details[iterator.prop.replace('Name', '') + 'Option'] || [];
}
};
initTableSelect();
getMyCurrentWarehouse({}).then(res => {
console.log('res :>> ', res);
const { code, data } = res.data;
if (code !== 200) return;
details.myWarehouseData = data;
});
/** 转译数据 */
const initData = (data, row) => {
const _item = details[data + 'Option'].find(val => val.value == Number(row[data]));
row[data + 'Name'] = _item ? _item.label : '暂无数据';
};
/** 请求页面数据 */
const onLoad = debounce(async (params = {}) => {
try {
// 开启loading
details.loadingObj.list = true;
details.query.loadId = details.pageInfo.loadId;
const submitData = { ...details.page, ...details.query, ...params };
// 扫码时间
if (getObjType(submitData.createTimeArr) === 'array') {
submitData.createTimeStartStr = submitData.createTimeArr[0];
submitData.createTimeEndStr = submitData.createTimeArr[1];
}
// 卸车时间
if (getObjType(submitData.unloadTimeArr) === 'array') {
submitData.unloadTimeStartStr = submitData.unloadTimeArr[0];
submitData.unloadTimeEndStr = submitData.unloadTimeArr[1];
}
delete submitData.createTimeArr;
delete submitData.unloadTimeArr;
// 请求页面数据
const res = await postLoadingDetail(submitData);
const { code, data } = res.data;
if (code !== 200) return;
details.data = data.records;
for (const iterator of details.data) {
initData('scanStatus', iterator);
initData('type', iterator);
initData('isData', iterator);
initData('loadingAbnormal', iterator);
initData('unloadAbnormal', iterator);
initData('isSupple', iterator);
}
details.page.total = data.total;
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.list = false;
}
}, 10);
/** 初始化请求数据 -- 之后节点数据 */
const init = async () => {
const res = await postFindNextNodeList({ loadId: $route.query.loadId });
// 下一步节点数据
const { code, data } = res.data;
if (code !== 200) return;
details.nextNodeData = data || [];
};
init();
/** 搜索 */
const searchChange = () => {
onLoad();
};
/** 清空表单 */
const searchReset = () => {
details.query = {};
details.page.pageNum = 1;
handleClearTableQuery(details.detailsColumnList);
onLoad();
};
/** 展开列表控件 */
const showdrawer = (_flag?: boolean, _type?: string) => {
switch (_type) {
case 'truckLoadingDetail':
details.editColumnList = details.detailsColumnList;
break;
default:
console.log('123 :>> ', 123);
details.editColumnList = details.columnList;
break;
// details.
}
details.drawerShow = _flag;
};
/** 是否开启搜索区 */
const searchHide = () => {
details.search = !details.search;
setNodeHeight(tableNodeRef.value.$el, '', true);
};
/** 表格表头输入框搜索 */
const inputsc = (index, row) => {
details.query[row.prop] = index;
if (!index && index !== 0) delete details.query[row.prop];
onLoad();
};
/** 表格表头时间选择 */
const timesc = (index, row) => {
console.log(index, row);
if (!!index) {
index = dayjs(index).format('YYYY-MM-DD');
}
details.query[row.prop] = index;
if (!index) {
delete details.query[row.prop];
}
onLoad();
};
/** 表格表头输入框搜索 */
const btnsc = () => {};
/** 表格表头下拉框选择 */
const selectsc = (index, row) => {
const _key = row.prop.replace('Name', '');
details.query[_key] = index;
if (!index && index !== 0) delete details.query[_key];
onLoad();
};
/** 表格表头复选框选择 */
const selectionChange = (list: any) => {
details.selectionList = list;
};
/** 每页数量改变执行的回调 */
const sizeChange = (pageSize: number) => {
details.page.pageSize = pageSize;
onLoad();
};
/** 页码改变执行的回调 */
const currentChange = pageNum => {
details.page.pageNum = pageNum;
onLoad();
};
/** 弹出层开启前清除数据 */
const beforeClose = done => {
done();
details.form = {};
details.view = false;
};
/** 新增中转 */
const addTransfer = async () => {
return null;
};
/** 修改中转 */
const editTransfer = async () => {
return null;
};
/** 显示新增或修改中转弹窗 */
const handleShowTransfer = async (_type: string) => {
switch (_type) {
// 新增
case 'add':
await addTransfer();
break;
// 修改
case 'edit':
await editTransfer();
break;
default:
break;
}
details.popUpShow.transferVisited = true;
nextTick(() => {
// 获取弹窗内表格元素节点, 并设置高度
const _nodeList = document.querySelectorAll('.transferPopUp .maboxhi');
_nodeList.forEach(val => (val.style.height = '300px'));
});
};
/** 批量卸车 */
const handleBatchUnLoad = async () => {
if (!ChecksWhetherTheWarehouseIsSelected())
return ElMessage.warning('多仓权限无法操作,请选择仓库');
try {
details.loadingObj.pageLoading = true;
if (details.selectionList.length === 0) return ElMessage.warning('请选择需要卸车的数据');
if (details.pageInfo.type !== 'TripartiteTransfer') {
if (!details.myWarehouseData) {
const res = await getMyCurrentWarehouse();
details.myWarehouseData = res.data.data;
}
if (!details.myWarehouseData) return ElMessage.warning('请先选择一个仓库');
// 当前登录人的仓库Id
const myWarehouseId = details.myWarehouseData.id;
// 包件列表
const _orderArr = [];
// 零担列表
const _zeroArr = [];
// 是否含有异常
let isHaveAbnormalData = false;
for (const iterator of details.selectionList) {
// 包件
if (Number(iterator.type) === 1) {
if (Number(iterator.scanStatus) === 1) {
_orderArr.push({
orderPackageCode: iterator.scanCode,
carsLoadScanId: iterator.carsLoadScanId,
});
}
} else {
_zeroArr.push({
waybillNo: iterator.waybillNo,
enterNum: iterator.num,
orderCode: iterator.orderCode,
carsLoadScanId: iterator.carsLoadScanId,
});
}
// 不重复判断是否有异常
if (!isHaveAbnormalData) {
isHaveAbnormalData = iterator.finalNodeId !== myWarehouseId;
}
}
if ([..._zeroArr, ..._orderArr].length === 0) return ElMessage.warning('没有符合要求的数据');
// 判断是否含有异常
if (!isHaveAbnormalData) {
ElMessageBox.confirm('是否卸车', '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
center: true,
})
// 异常提交
.then(async () => {
try {
details.loadingObj.pageLoading = true;
const submitData = {
loadId: details.pageInfo.loadId,
unloadPackageList: _orderArr,
unloadZeroList: _zeroArr,
incomingType: '7',
};
const res = await postBatchUnload(submitData);
const { code } = res.data;
if (code !== 200) return;
ElMessage.success('卸车成功');
onLoad();
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
});
return;
}
ElMessageBox.confirm('包含已卸车数据或计划不在本节点卸车的数据', '异常提交', {
confirmButtonText: '提交包含不在本节点数据',
cancelButtonText: '仅提交装车数据',
type: 'warning',
center: true,
distinguishCancelAndClose: true,
})
// 异常提交
.then(async () => {
try {
details.loadingObj.pageLoading = true;
const submitData = {
loadId: details.pageInfo.loadId,
unloadPackageList: _orderArr,
unloadZeroList: _zeroArr,
incomingType: '7',
};
const res = await postBatchUnload(submitData);
const { code } = res.data;
if (code !== 200) return;
ElMessage.success('卸车成功');
onLoad();
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
})
// 仅去除已装车和已签收数据
.catch(async (action: Action) => {
if (action !== 'cancel') return;
try {
details.loadingObj.pageLoading = true;
const submitData = {
loadId: details.pageInfo.loadId,
unloadPackageList: _orderArr.filter(val => val.finalNodeId === myWarehouseId),
unloadZeroList: _zeroArr.filter(val => val.finalNodeId === myWarehouseId),
incomingType: '7',
};
const res = await postBatchUnload(submitData);
const { code } = res.data;
if (code !== 200) return;
ElMessage.success('卸车成功');
onLoad();
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
});
} else {
// 三方中转
// 包件列表
const _orderArr = [];
// 零担列表
const _zeroArr = [];
for (const iterator of details.selectionList) {
if (Number(iterator.scanStatus) === 1) {
// 包件
if (Number(iterator.type) === 1) {
_orderArr.push({
orderPackageCode: iterator.scanCode,
carsLoadScanId: iterator.carsLoadScanId,
});
} else {
_zeroArr.push({
waybillNo: iterator.waybillNo,
enterNum: iterator.num,
orderCode: iterator.orderCode,
carsLoadScanId: iterator.carsLoadScanId,
});
}
}
}
if ([..._zeroArr, ..._orderArr].length === 0) return ElMessage.warning('请选择未卸车的数据');
ElMessageBox.confirm('是否卸车', '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
center: true,
})
// 异常提交
.then(async () => {
try {
details.loadingObj.pageLoading = true;
// 判断是否含有异常
const submitData = {
loadId: details.pageInfo.loadId,
unloadPackageList: _orderArr,
unloadZeroList: _zeroArr,
};
const res = await postBatchTransferUnload(submitData);
const { code } = res.data;
if (code !== 200) return;
ElMessage.success('卸车成功');
onLoad();
return;
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
});
}
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
};
/** 卸车 -- 订单 */
const handleOrderUnLoad = async ({ row }) => {
if (!ChecksWhetherTheWarehouseIsSelected())
return ElMessage.warning('多仓权限无法操作,请选择仓库');
if (details.pageInfo.type !== 'TripartiteTransfer') {
if (!details.myWarehouseData) {
const res = await getMyCurrentWarehouse();
details.myWarehouseData = res.data.data;
}
if (!details.myWarehouseData) return ElMessage.warning('请先选择一个仓库');
// 当前登录人的仓库Id
const myWarehouseId = details.myWarehouseData.id;
console.log('details.myWarehouseData :>> ', details.myWarehouseData);
console.log('row.finalNodeId !== myWarehouseId :>> ', row);
console.log('myWarehouseId :>> ', myWarehouseId);
if (row.finalNodeId !== myWarehouseId)
return (
ElMessageBox.confirm('包含已卸车数据或计划不在本节点卸车的数据', '异常提交', {
confirmButtonText: '提交包含不在本节点数据',
cancelButtonText: '取消',
type: 'warning',
center: true,
})
// 异常提交
.then(async () => {
try {
details.loadingObj.pageLoading = true;
const submitData = {
loadId: details.pageInfo.loadId,
unloadPackageList: [
{ orderPackageCode: row.scanCode, carsLoadScanId: row.carsLoadScanId },
],
unloadZeroList: [],
incomingType: '7',
};
const res = await postBatchUnload(submitData);
const { code } = res.data;
if (code !== 200) return;
ElMessage.success('卸车成功');
onLoad();
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
})
.catch(() => {})
);
ElMessageBox.confirm('是否卸车', '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
center: true,
}).then(async () => {
try {
details.loadingObj.pageLoading = true;
const submitData = {
loadId: details.pageInfo.loadId,
unloadPackageList: [
{ orderPackageCode: row.scanCode, carsLoadScanId: row.carsLoadScanId },
],
unloadZeroList: [],
incomingType: '7',
};
const res = await postBatchUnload(submitData);
const { code } = res.data;
if (code !== 200) return;
ElMessage.success('卸车成功');
onLoad();
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
});
} else {
// 三方中转
ElMessageBox.confirm('是否卸车', '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
center: true,
}).then(async () => {
try {
details.loadingObj.pageLoading = true;
const submitData = {
loadId: details.pageInfo.loadId,
orderPackageCode: row.scanCode,
};
const res = await postTransferUnloadPackage(submitData);
const { code } = res.data;
if (code !== 200) return;
ElMessage.success('卸车成功');
onLoad();
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
});
}
};
/** 卸车 -- 零担 */
const handleZeroUnLoad = async ({ row }, type: 'view' | 'edit') => {
if (!ChecksWhetherTheWarehouseIsSelected())
return ElMessage.warning('多仓权限无法操作,请选择仓库');
if (details.pageInfo.type !== 'TripartiteTransfer') {
if (!details.myWarehouseData) {
const res = await getMyCurrentWarehouse();
details.myWarehouseData = res.data.data;
}
if (!details.myWarehouseData) return ElMessage.warning('请先选择一个仓库');
if (type === 'edit' && details.myWarehouseData.id !== row.finalNodeId)
return ElMessage.warning('未在目的仓, 无法卸车');
}
details.zeroItem = { ...row, type };
details.zeroItem.enterNum = !details.zeroItem.unloadNum ? row.num : details.zeroItem.unloadNum;
try {
details.loadingObj.pageLoading = true;
const res = await postFindZeroDetailByCarsLoadScanId({ carsLoadScanId: row.carsLoadScanId });
const { code, data } = res.data;
if (code !== 200 || getObjType(data) !== 'array') return;
details.zeroItem.zeroPackageSupplyVOS = data;
for (let i = 0; i < details.zeroItem.zeroPackageSupplyVOS.length; i++) {
const item = details.zeroItem.zeroPackageSupplyVOS[i];
item.enterNum = item.unloadNum || item.loadingNum || 0;
}
details.popUpShow.transferVisited = true;
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
};
/** 卸车 -- 零担 -- 提交 */
const handleZeroUnLoadSubmit = async () => {
try {
details.popUpShow.transferVisited = false;
details.loadingObj.pageLoading = true;
// let res: any = {};
// if (details.pageInfo.type !== 'TripartiteTransfer') {
const submitData = {
loadId: details.pageInfo.loadId,
waybillNo: details.zeroItem.waybillNo,
orderCode: details.zeroItem.orderCode,
productName: details.zeroItem.scanCode,
enterNum: 0,
incomingType: '7',
carsLoadScanId: details.zeroItem.carsLoadScanId,
zeroPackageList: details.zeroItem.zeroPackageSupplyVOS,
};
let _loadingNum = 0;
for (let i = 0; i < submitData.zeroPackageList.length; i++) {
const val = submitData.zeroPackageList[i];
val.enterNum = val.enterNum || 0;
_loadingNum += val.enterNum;
}
submitData.enterNum = _loadingNum;
if (submitData.enterNum === 0) return ElMessage.warning('卸车总数为零,请填写需要卸车的数据');
const res =
details.pageInfo.type !== 'TripartiteTransfer'
? await postUnloadZero(submitData)
: await postTransferUnloadZero(submitData);
// } else {
// const submitData = {
// loadId: details.pageInfo.loadId,
// waybillNo: details.zeroItem.waybillNo,
// enterNum: details.zeroItem.num,
// orderCode: details.zeroItem.orderCode,
// incomingType: '7',
// carsLoadScanId: details.zeroItem.carsLoadScanId,
// };
// res = await postTransferUnloadZero(submitData);
// }
const { code } = res.data;
if (code !== 200) return;
ElMessage.success('卸车成功');
onLoad();
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
};
/** 单列查看包条码 */
const printOrder = async ({ row }) => {
try {
details.loadingObj.pageLoading = true;
let qr = {
orderPackageCodes: row.scanCode,
};
details.html = '';
const res = await getShowAdvancePackgeCode(qr);
const { code, data } = res.data;
if (code !== 200 || getObjType(data.moldList) !== 'array') return;
for (let i = 0; i < data.moldList.length; i++) {
details.html += data.moldList[i];
}
details.popUpShow.QRCodeVisible = true;
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
};
/** 查看零担零担码 */
const printOrderByZero = async ({ row }) => {
try {
details.loadingObj.pageLoading = true;
let ids = [
{
orderCode: row.orderCode,
fromWarehouseId: row.fromWarehouseId,
},
];
details.html = '';
const res = await postShowOrderCodeByCode(ids);
const { code, data } = res.data;
if (code !== 200 || getObjType(data.moldList) !== 'array') return;
for (let i = 0; i < data.moldList.length; i++) {
details.html += data.moldList[i];
}
details.popUpShow.QRCodeVisible = true;
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
};
/** 批量查看二维码 */
const handleBatchBarcode = async () => {
if (details.selectionList.length === 0)
return ElMessage.warning({ message: '请选择需要查看的数据' });
const _arr = [];
const _zeroArr = [];
for (const iterator of details.selectionList) {
if (Number(iterator.type) === 1) _arr.push(iterator);
else _zeroArr.push(iterator);
}
// tableNodeRef.value.handleClearSelect();
// tableNodeRef.value.handleCheckSelect(_arr);
// if (_arr.length === 0) return ElMessage.warning('零担无法查看二维码');
try {
details.loadingObj.pageLoading = true;
details.html = '';
const _promiseArr = [];
_arr.length > 0 &&
_promiseArr.push(
getShowAdvancePackgeCode({
orderPackageCodes: _arr.map(val => val.scanCode).join(','),
}).then(res => {
const { code, data } = res.data;
if (code !== 200 || getObjType(data.moldList) !== 'array') return;
for (let i = 0; i < data.moldList.length; i++) {
details.html += data.moldList[i];
}
})
);
_zeroArr.length > 0 &&
_promiseArr.push(
postShowOrderCodeByCode(
_zeroArr.map(val => {
return {
orderCode: val.orderCode,
fromWarehouseId: val.fromWarehouseId,
};
})
).then(res => {
const { code, data } = res.data;
if (code !== 200 || getObjType(data.moldList) !== 'array') return;
for (let i = 0; i < data.moldList.length; i++) {
details.html += data.moldList[i];
}
})
);
await Promise.all(_promiseArr);
details.popUpShow.QRCodeVisible = true;
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
};
/** 批量移除 */
const handleBatchRemove = async () => {
const WarehouseName = localStorage.getItem('WarehouseName');
if (!ChecksWhetherTheWarehouseIsSelected())
return ElMessage.warning('多仓权限无法操作,请选择仓库');
if (details.selectionList.length === 0) return ElMessage.warning('请选择需要删除的数据');
for (let i = 0; i < details.selectionList.length; i++) {
const item = details.selectionList[i];
if (Number(item.scanStatus) !== 1 && Number(item.isData) === 1)
return ElMessage.warning('不能删除签收或卸车数据');
console.log('item.warehouseName :>> ', item.warehouseName);
console.log('WarehouseName :>> ', WarehouseName);
if (WarehouseName !== item.warehouseName) {
if (item.isData !== 0) return ElMessage.warning('不能删除其它仓库的装车数据');
}
}
ElMessageBox.confirm('是否批量删除数据', '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
center: true,
})
// 异常提交
.then(async () => {
try {
details.loadingObj.pageLoading = true;
const submitData = { carsLoadScanIds: details.selectionList.map(val => val.id).join(',') };
const response = await postRemoveCarsLoadScan(submitData);
const { code, msg } = response.data;
if (code !== 200) return;
ElMessage.success({ message: msg });
onLoad();
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
});
};
/** 三方批量签收 */
const handleBatchSigin = async () => {
if (!ChecksWhetherTheWarehouseIsSelected())
return ElMessage.warning('多仓权限无法操作,请选择仓库');
if (details.selectionList.length === 0) return ElMessage.warning('请选择需要签收的数据');
const loadScanIds = [];
for (let i = 0; i < details.selectionList.length; i++) {
const value = details.selectionList[i];
if (Number($route.query.deliveryType) === 1 && Number(value.scanStatus) === 1) {
return ElMessage.warning('存在未卸车数据,请卸车后再签收');
}
// 查看该包件是否为已签收状态
if (Number(value.scanStatus) === 3) continue;
loadScanIds.push(value.id);
}
if (loadScanIds.length === 0) return ElMessage.warning('请选择未签收的数据');
ElMessageBox.confirm('是否批量签收数据', '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
center: true,
}).then(async () => {
try {
details.loadingObj.pageLoading = true;
const submitData = { loadScanIds };
const response = await postSignLoadScanByIds(submitData);
const { code, msg } = response.data;
if (code !== 200) return;
if (msg) ElMessage.success({ message: msg });
onLoad();
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
});
};
const handleExport = async () => {
try {
details.loadingObj.pageLoading = true;
const res = await postLoadingDetailExport({ loadId: $route.query.loadId });
const { status, data } = res;
console.log('status :>> ', status);
if (status !== 200) return;
downloadXls(data, $route.query.name);
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
};
/** 选择包件进行更改计划仓 */
const handleChooseWarehouse = async () => {
if (!ChecksWhetherTheWarehouseIsSelected())
return ElMessage.warning('多仓权限无法操作,请选择仓库');
if (details.selectionList.length === 0) return ElMessage.warning('请选择需要更改的数据');
const _arr = [];
for (let i = 0; i < details.selectionList.length; i++) {
const item = details.selectionList[i];
if (Number(item.scanStatus) === 1) _arr.push(item);
}
tableNodeRef.value.handleClearSelect();
tableNodeRef.value.handleCheckSelect(_arr);
await nextTick();
if (_arr.length === 0) return ElMessage.warning('请选择未卸车数据');
details.choosePackageList = _arr;
details.popUpShow.chooseDestinationVisited = true;
};
/** 配置装车目的地 */
const handleEditSubmit = async () => {
if (!details.chooseNodeId) return ElMessage.warning('请选择目的仓');
details.loadingObj.pageLoading = true;
try {
const submitData = {
loadId: $route.query.loadId,
loadScanFinalNodeIdList: [],
};
for (const iterator of details.choosePackageList) {
submitData.loadScanFinalNodeIdList.push({
loadScanId: iterator.id,
finalNodeId: details.chooseNodeId,
});
}
details.popUpShow.chooseDestinationVisited = false;
const res = await postUpdateLoadScanFinalNodeIdById(submitData);
const { code, msg } = res.data;
if (code !== 200) return;
if (msg) ElMessage.success(msg);
details.chooseNodeId = '';
onLoad();
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
};
/** 零担批量卸车确认 */
const handleBatchLoadConfirm = () => {
if (details.selectionList.length === 0) return ElMessage.warning('请选择需要确认的零担数据');
const loadScanIds = [];
for (let i = 0; i < details.selectionList.length; i++) {
const val = details.selectionList[i];
if (!isNumber(val.unloadNum) || val.unloadNum <= 0)
return ElMessage.warning('零担卸车确认需要卸车数大于0');
if (Number(val.type) !== 2) return ElMessage.warning('请勿选择包件数据');
loadScanIds.push(val.id);
}
ElMessageBox.confirm('是否批量确认零担数据', '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
center: true,
}).then(async () => {
try {
details.loadingObj.pageLoading = true;
const submitData = { loadScanIds };
const response = await postZeroUnloadEnter(submitData);
const { code, msg } = response.data;
if (code !== 200) return;
if (msg) ElMessage.success({ message: msg });
onLoad();
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
});
};
const initPage = () => {
details.pageInfo.loadId = $route.query.loadId;
details.pageInfo.type = $route.query.type;
onLoad();
};
initPage();
</script>
<style scoped lang="scss">
.fo-fl {
display: flex;
flex-wrap: wrap;
zoom: 0.9;
}
// 日期选择器
:deep(.el-date-editor.el-input) {
height: 100% !important;
width: 100% !important;
}
:deep(.el-range-editor.el-input__wrapper) {
height: 100% !important;
}
// 新增行
.add_row {
display: flex;
justify-content: space-between;
}
.add_row_title {
text-align: center;
margin-bottom: 10px;
font-size: 18px;
font-weight: bold;
}
// 统计行
.statistics_row {
margin: 10px 0;
font-size: 14px;
zoom: 0.9;
display: flex;
> div {
margin-right: 20px;
}
}
// 卡片容器
.crad_container {
display: flex;
.card_container_item {
flex: 1;
// padding: 10px;
border-radius: 5px;
box-shadow: 0 0 5px #ccc;
&:first-child {
margin-right: 20px;
}
.card_container_item_title {
padding: 10px;
border-bottom: 1px solid #ccc;
display: flex;
justify-content: space-between;
align-items: center;
}
.card_container_item_box {
padding: 10px;
}
}
}
.pointer {
cursor: pointer;
}
.transferPopUp :deep(.el-textarea) {
width: 500px;
}
:deep(.el-table tr) {
&.Abnormal {
.tabculconte,
.el-tooltip,
.el-button--text,
.el-text {
// color: #e54b4b !important;
color: #f00 !important;
}
}
}
:deep(.el-tag) {
&.err {
background-color: #f8544b;
border-color: #f8544b;
color: #fff;
}
&.primary {
background-color: green;
border-color: green;
color: #fff;
}
&.sub {
background-color: #d3832a;
border-color: #d3832a;
color: #fff;
}
}
// 编辑零担品类数量 -- 顶部信息
.editZeroCategoryTitleRow {
display: flex;
flex-wrap: wrap;
.title {
font-weight: bold;
margin-right: 10px;
}
}
// 编辑零担品类数量 -- 分隔线
.editZeroCategoryTitleRowByLine {
display: flex;
align-items: center;
font-size: 18px;
font-weight: bold;
color: var(--el-color-primary);
&::before {
content: '';
display: block;
height: 2px;
flex: 1;
background-color: var(--el-color-primary);
margin-right: 10px;
}
&::after {
content: '';
display: block;
height: 2px;
flex: 1;
background-color: var(--el-color-primary);
margin-left: 10px;
}
}
// 编辑零担品类数量 -- 品类列表
.editZeroCategoryList {
padding: 10px;
.editZeroCategoryList_item {
padding: 20px;
border: 2px dashed var(--el-color-primary);
border-radius: 5px;
margin-top: 10px;
&:first-child {
margin-top: 0;
}
}
.inputNum {
:deep(.el-input__inner) {
text-align: left;
}
}
.w100 {
width: 100% !important;
}
}
</style>