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.

999 lines
27 KiB

<template>
<basic-container v-loading="details.loadingObj.pageLoading">
<div class="avue-crud">
<el-tabs @tab-click="handleCheckTab" type="border-card" v-model="details.activeTab">
<el-tab-pane label="详 情 信 息" name="tab1">
<!-- 标题 基础信息 -->
<el-divider content-position="left">
<div class="flex-c-c">
<el-icon class="mr10"><Document /></el-icon>
</div>
</el-divider>
<!-- 表单 -->
<el-form disabled :inline="true" label-width="100px" :model="form" class="el-fr-d">
<div class="fo-fl">
<el-form-item label="中转承运商" prop="carrierName" style="flex: 1">
<el-input v-model="form.carrierName"> </el-input>
</el-form-item>
<el-form-item label="经办人" prop="operator">
<el-input v-model="form.operator" />
</el-form-item>
<el-form-item label="送货方式" prop="deliveryType">
<el-select
:teleported="false"
v-model="form.deliveryType"
class="m-2"
size="default"
>
<el-option
v-for="item in details.pageInfo.deliveryType || []"
:key="item.dictValue"
:label="item.dictValue"
:value="item.dictKey"
/>
</el-select>
</el-form-item>
<el-form-item label="付款方式" prop="payMethod">
<el-select :teleported="false" v-model="form.payMethod" class="m-2" size="default">
<el-option
v-for="item in details.pageInfo.payMethod || []"
:key="item.dictValue"
:label="item.dictValue"
:value="item.dictKey"
/>
</el-select>
</el-form-item>
<el-form-item label="运费分摊方式" prop="chargeType">
<el-select :teleported="false" v-model="form.chargeType" class="m-2" size="default">
<el-option
v-for="item in details.pageInfo.chargeType || []"
:key="item.dictValue"
:label="item.dictValue"
:value="item.dictKey"
/>
</el-select>
</el-form-item>
<el-form-item label="送货司机" prop="driverName">
<el-select
v-model="form.driverName"
filterable
:teleported="false"
remote
@change="handleNameChange"
reserve-keyword
:remote-method="remoteMethodDriver"
:loading="details.loadingObj.loading"
>
<el-option
v-for="val in details.driverListByName"
:key="val.driverName"
:label="val.driverName"
:value="val.driverId"
/>
</el-select>
</el-form-item>
<el-form-item label="客户类型" prop="customerType">
<el-select
:teleported="false"
v-model="form.customerType"
class="m-2"
multiple
size="default"
>
<el-option
v-for="item in details.pageInfo.customerType || []"
:key="item.dictValue"
:label="item.dictValue"
:value="item.dictKey"
/>
</el-select>
</el-form-item>
<el-form-item label="是否结算" prop="isSettlement">
<el-select
:teleported="false"
v-model="form.isSettlement"
class="m-2"
size="default"
>
<el-option
v-for="item in details.pageInfo.settlementStatus || []"
:key="item.dictValue"
:label="item.dictValue"
:value="item.dictKey"
/>
</el-select>
</el-form-item>
<el-form-item label="代收贷款" prop="replacePrice">
<el-input-number
v-model="form.replacePrice"
:precision="2"
:min="0"
:step="1"
:controls="false"
/>
</el-form-item>
<el-form-item label="承运单号" prop="carrierOrderCode">
<el-input v-model="form.carrierOrderCode" />
</el-form-item>
<el-form-item label="承运时间" prop="carrierTimeStr">
<el-date-picker
v-model="form.carrierTimeStr"
type="date"
size="default"
:teleported="false"
/>
</el-form-item>
<el-form-item label="客户收货时间" prop="receivingTimeStr">
<el-date-picker
v-model="form.receivingTimeStr"
type="date"
size="default"
:teleported="false"
/>
</el-form-item>
<el-form-item label="运费" prop="countTransportCost">
<el-input-number
v-model="form.countTransportCost"
:precision="2"
:min="0"
:step="1"
:controls="false"
/>
</el-form-item>
<el-form-item label="司机结算费" prop="settlementValue">
<el-input-number
v-model="form.settlementValue"
:precision="2"
:min="0"
:step="1"
:controls="false"
/>
</el-form-item>
<div style="flex: 1; padding-right: 0">
<el-form-item
style="width: 100%; margin: 0"
label="备注"
label-width="100px"
:inline="false"
>
<el-input type="textarea" v-model="form.remark" />
</el-form-item>
</div>
</div>
</el-form>
<!-- 标题 运单信息 -->
<el-divider content-position="left">
<div class="flex-c-c">
<el-icon class="mr10"><Switch /></el-icon>
</div>
</el-divider>
<!-- 运单池 && 调度池 -->
<!-- 列表模块 -->
<div v-h5uShow="!search">
<el-form
:inline="true"
label-width="80px"
:model="details.oldQuery"
class="header_search"
>
<el-form-item class="el-times" label="开单时间">
<el-date-picker
v-model="stockupDate"
type="daterange"
unlink-panels
range-separator="-"
start-placeholder="开单日期"
end-placeholder="开单日期"
:shortcuts="shortcuts"
clearable
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="searchReset()"
> </el-button
>
<el-button icon="el-icon-delete" @click="searchReset()">重置</el-button>
</el-form-item>
</el-form>
</div>
<!-- 控件 -->
<div style="margin-bottom: 10px" class="flex-c-sb">
<div>
<el-button type="primary" icon="Promotion" @click="searchReset()">
成本分摊确认
</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, 1)" circle></el-button>
<el-button icon="el-icon-search" @click="searchHide" circle></el-button>
</div>
</div>
<!-- 表格 -->
<tablecmt
ref="oldColumnListNode"
:columnList="details.columnList"
:tableData="details.oldData"
:loading="loadingObj.oldListLoading"
@inputTxt="inputsc"
@timeCheck="timesc"
@selectCheck="selectsc"
@selection="selectionChange"
>
<template #default="slotProps">
<template v-if="slotProps.scope.column.label === '运单号'">
<el-text @click="handleGoWaybillDetails(slotProps.scope)">
{{ slotProps.scope.row.waybillNo }}
</el-text>
</template></template
>
</tablecmt>
</el-tab-pane>
<el-tab-pane label="操 作 日 志" name="tab2">
<div style="min-height: 300px">
<el-steps direction="vertical" space="120px" :active="details.loadLogsList.length">
<el-step :title="item.abstText" v-for="item in details.loadLogsList" :key="item">
<template #description>
<div class="fz-0-9">
<el-row>
<div class="flex-c-c mr10">
<el-icon color="#172e60" class="mr10" size="20px"><Clock /></el-icon>
<span>操作时间</span>
<span>{{ item.updateTime }}</span>
</div>
<div class="flex-c-c mr10">
<el-icon color="#172e60" size="20px"><Location /></el-icon>
<span>操作网点</span>
<span>{{ item.nodeName }}</span>
</div>
<div class="flex-c-c mr10">
<el-icon color="#172e60" size="20px"><User /></el-icon>
<span>操作人</span>
<span>{{ item.createUserName }}</span>
</div>
</el-row>
<div class="word-break-break-all mt10">
{{ item.content }}
</div>
</div>
</template>
<template #icon>
<el-icon color="#172e60" size="20px"><HelpFilled /></el-icon>
</template>
</el-step>
</el-steps>
</div>
</el-tab-pane>
</el-tabs>
</div>
</basic-container>
<edittablehead
@setcolum="setnewcolum"
@closce="showdrawer"
:drawerShow="drawerShow"
:columnList="columnList"
>
</edittablehead>
</template>
<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 } from 'vuex';
/** 获取字典 */
import { getDictionaryBiz } from '@/api/system/dict';
import { downloadXls, computeNumber, setNodeHeight, debounce, deepClone } from '@/utils/util';
import { columnList } from '@/option/distribution/addVehicleStowage';
import {
postloadFindLoadInitData,
postFindWarehouseListByName,
postFindCarListByName,
postFindDriverListByName,
postFindCarrierByName,
postFindUseOrderList,
postSelectEditDetailByLoadId,
} from '@/api/distribution/AddVehicleStowage';
import { postCarsLoadDetailInfo } from '@/api/distribution/VehicleStowageDetails.js';
import { postSaveNewTripartiteTransfer } from '@/api/distribution/addTripartiteTransfer.js';
import { postFindCarsLoadLogs } from '@/api/distribution/VehicleStowageDetails.js';
import type { FormInstance, FormRules } from 'element-plus';
import { useRouter, useRoute } from 'vue-router';
import { useStore } from 'vuex';
// 获取vuex仓库
const $store = useStore();
// 获取路由实例
const $router = useRouter();
const $route = useRoute();
// 表单实例
const ruleFormRef = ref();
// 表格实例
const oldColumnListNode = ref();
const details = reactive<any>({
activeTab: 'tab1',
/** 是否开启搜索 */
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];
},
},
],
/** 时间选择器数据 */
stockupDate: [],
/** 修改的列表信息 */
editColumnList: [],
/** 运单池 */
columnList: deepClone(columnList),
/** 列表数据 */
oldData: [],
/** 渲染数据 */
renderData: [],
rules: {
/** 中转承运商 */
carrierName: [
{
required: true,
message: '请选择承运商',
trigger: ['change', 'blur'],
},
],
/** 经办人 */
operator: [
{
required: true,
message: '请选择经办人',
trigger: ['change'],
},
],
/** 客户类型 */
customerType: [
{
required: true,
message: '请选择客户类型',
trigger: ['change'],
},
],
/** 承运单号 */
carrierOrderCode: [
{
required: true,
message: '请选择承运单号',
trigger: ['change', 'blur'],
},
],
/** 承运时间 */
carrierTime: [
{
required: true,
message: '请选择承运时间',
trigger: ['change'],
},
],
/** 运费 */
num: [
{
required: true,
message: '请填写运费',
trigger: ['change'],
},
],
},
/** 页面loading */
loadingObj: {
/** 列表加载loading */
list: false,
oldListLoading: false,
pageLoading: false,
},
/** 列表复选框选中的数据 */
selectionList: [],
newSelectionList: [],
/** 是否显示设置表格 */
drawerShow: false,
/** 分页参数 */
page: {
pageNum: 1,
pageSize: 30,
total: 0,
},
oldPage: {
pageNum: 1,
pageSize: 30,
total: 0,
},
/** 弹出层显示 */
popUpShow: {
/** 装车详情 */
truckLoadingDetailVisited: false,
/** 零担补录 */
transferVisited: false,
},
/** 列表Dom节点 */
listNode: '',
form: {
customerType: '',
},
/** 页面数据 */
pageInfo: {},
/** 承运商 */
carrierNameOptions: [],
/** 客户类型 */
customerType: [],
/** 送货司机 */
driverListByName: [],
/** 被选中在调度池的订单列表 */
orderCodeList: [],
/** 配载日志 */
loadLogsList: [],
});
for (let i = 0; i < details.columnList.length; i++) {
const value = details.columnList[i];
if (value.prop === 'waybillNo') {
value.type = 13;
break;
}
}
const {
search,
query,
shortcuts,
stockupDate,
data,
loadingObj,
selectionList,
drawerShow,
page,
popUpShow,
form,
oldPage,
} = toRefs(details);
/** vuex */
const permission = computed(() => mapGetters(['permission', 'tagWel', 'tagList']));
console.log('permission :>> ', permission);
onMounted(() => {
const timer = setTimeout(() => {
details.listNode = document.querySelector('.maboxhi');
details.listNode.style.transition = 'all .5s ease-out';
console.log('details.listNode :>> ', details.listNode);
clearTimeout(timer);
}, 100);
/**
* 初始化获取本地缓存的编辑隐藏的列表
* 固定搭配不能更改
*/
let checkListnewarr = functions.getStorage(window.location.pathname + 'checkList');
let flexListnewarr = functions.getStorage(window.location.pathname + 'flexList');
let sortlistnewarr = functions.getStorage(window.location.pathname + 'sortlist');
if (checkListnewarr) {
details.columnList.map(item => {
item.head = false;
});
checkListnewarr.map(ite => {
details.columnList.map(item => {
if (ite == item.label) {
item.head = true;
}
});
});
} else {
let arr = [];
details.columnList.map(item => {
if (item.head) {
arr.push(item.label);
}
});
functions.setStorage(window.location.pathname + 'checkList', arr);
}
if (flexListnewarr) {
details.columnList.map(item => {
item.fixed = false;
});
flexListnewarr.map(ite => {
details.columnList.map(item => {
if (ite == item.label) {
if (item.type == 6) {
item.fixed = 'right';
} else {
item.fixed = true;
}
}
});
});
} else {
let arr = [];
details.columnList.map(item => {
if (item.fixed) {
arr.push(item.label);
}
});
functions.setStorage(window.location.pathname + 'flexList', arr);
}
if (sortlistnewarr) {
details.columnList.map(item => {
item.sortable = false;
});
sortlistnewarr.map(ite => {
details.columnList.map(item => {
if (ite == item.label) {
item.sortable = true;
}
});
});
} else {
let arr = [];
details.columnList.map(item => {
if (item.sortable) {
arr.push(item.label);
}
});
functions.setStorage(window.location.pathname + 'sortlist', arr);
}
});
/** 请求页面数据 */
const onLoad = debounce(async () => {
try {
details.loadingObj.pageLoading = true;
// 获取表单信息
const promiseAll = await Promise.all([
// 获取下拉列表
postloadFindLoadInitData(),
// 获取表单数据
// postSelectEditDetailByLoadId({ loadId: $route.query.loadId }),
postCarsLoadDetailInfo({ loadId: $route.query.loadId }),
]);
console.log('promiseAll :>> ', promiseAll);
const [
{
data: { code, data },
},
{
data: { code: code1, data: data1 },
},
] = promiseAll;
console.log('code :>> ', code);
console.log('code1 :>> ', code1);
if (code !== 200 && code1 !== 200) return;
details.pageInfo = data;
details.customerType = data.customerType;
console.log('data :>> ', data);
details.form = data1;
details.form.customerType = data1.customerType.split(',');
details.form.startWarehouseName = data.startWarehouseInfo.warehouseName;
details.form.startWarehouseId = data.startWarehouseInfo.warehouseId;
details.form.carrierTimeStr = details.form.carrierTime;
details.form.receivingTimeStr = details.form.receivingTime;
delete details.form.carrierTime;
delete details.form.receivingTime;
data1.carsLoadWaybillInfoList.forEach(val => {
details.oldData.push(
...val.carsLoadOrderInfoList.map((item, index) => {
item = { ...val, ...item };
const _planArr: any = { ...val, ...item };
delete item.carsLoadOrderInfoList;
delete item.carsLoadOrderInfoListPlan;
if (index === 0) item.mergeColumnIndex = val.carsLoadOrderInfoList.length;
else {
item.mergeColumnIndex = 0;
for (let value of mergeColumn) {
item[value] = '';
}
}
return item;
})
);
});
// await initOriginWarehouseOrder();
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
}, 10);
onLoad();
/** 请求运单数据 */
const initOriginWarehouseOrder = async (params = {}) => {
try {
// 开启列表加载动画
const submitData = {
loadId: $route.query.loadId,
finalNodeId: details.form.startWarehouseId,
};
const res = await postFindUseOrderList(submitData);
const { code, data } = res.data;
if (code !== 200) return;
details.oldData = data;
details.renderData = data;
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.oldListLoading = false;
}
};
/** 搜索 */
const searchChange = () => {
onLoad();
};
/** 清空表单 */
const searchReset = () => {
details.query = {};
details.stockupDate = [];
details.page.pageNum = 1;
onLoad();
};
// 清空复选框
const clearSelectionList = () => {
details.selectionList = [];
details.newSelectionList = [];
oldColumnListNode.value.handleCheckSelect([]);
};
/** 展开列表控件 */
const showdrawer = (_flag?: boolean, _type?: number) => {
switch (_type) {
default:
console.log('123 :>> ', 123);
details.editColumnList = details.columnList;
break;
// details.
}
details.drawerShow = _flag;
};
/** 是否开启搜索区 */
const searchHide = async () => {
details.search = !details.search;
await nextTick();
setNodeHeight(details.listNode, '50vh');
};
/** 查询司机信息 */
const remoteMethodDriver = async val => {
const res = await postFindDriverListByName({ driverName: val });
console.log('res :>> ', res);
const { code, data } = res.data;
if (code !== 200) return;
details.driverListByName = data;
};
/** 表格表头输入框搜索 */
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 selectsc = (index, row) => {
details.query[row.prop] = index;
if (!index && index !== 0) delete details.query[row.prop];
if (row.prop === 'certificateTypeName') {
details.query['certificateType'] = index;
if (!index) delete details.query['certificateType'];
}
onLoad();
};
/** 表格表头复选框选择 */
const selectionChange = (list: any) => {
details.selectionList = list;
};
/** 表格表头输入框搜索 */
const newInputsc = (index, row) => {
details.newQuery[row.prop] = index;
onLoad();
};
/** 表格表头时间选择 */
const newTimesc = (index, row) => {
console.log(index, row);
if (!!index) {
index = dayjs(index).format('YYYY-MM-DD');
}
details.newQuery[row.prop] = index;
if (!index) {
delete details.newQuery[row.prop];
}
onLoad();
};
/** 表格表头输入框搜索 */
const newBtnsc = () => {};
/** 表格表头下拉框选择 */
const newSelectsc = (index, row) => {
details.newQuery[row.prop] = index;
if (!index) delete details.newQuery[row.prop];
if (row.prop === 'certificateTypeName') {
details.newQuery['certificateType'] = index;
if (!index) delete details.newQuery['certificateType'];
}
onLoad();
};
/** 表格表头复选框选择 */
const newSelectionChange = (list: any) => {
details.newSelectionList = list;
};
/** 每页数量改变执行的回调 */
const sizeChange = (pageSize: number) => {
details.page.pageSize = pageSize;
onLoad();
};
/** 页码改变执行的回调 */
const currentChange = () => {};
/**
* 设置列表 -- 固定函数
* 弹窗的勾选回调用于更改头部数组
* 固定搭配只需要更换 columnList
* */
const setnewcolum = (newarr, headarr, type) => {
if (type == 1) {
details.columnList = newarr;
functions.setStorage(window.location.pathname + 'checkList', headarr);
} else if (type == 2) {
details.columnList = newarr;
functions.setStorage(window.location.pathname + 'flexList', headarr);
} else if (type == 3) {
details.columnList = newarr;
functions.setStorage(window.location.pathname + 'sortlist', headarr);
}
};
/** 选择承运商 */
const carrierNameChange = () => {};
/** 司机改变时 */
const handleNameChange = () => {
const findValue = form.value.driverName;
const _value = details.driverListByName.find(value => value.driverId === findValue);
form.value.driverName = _value.driverName;
form.value.driverId = _value.driverId;
form.value.driverMobile = _value.driverPhone;
};
/** 请求日志跟踪 */
const handleSignLoadScanLogs = async () => {
try {
details.loadingObj.pageLoading = true;
const submitData = { loadId: $route.query.loadId };
const res = await postFindCarsLoadLogs(submitData);
const { code, data } = res.data;
if (code !== 200) return;
details.loadLogsList = data;
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
};
const handleCheckTab = e => {
console.log('e :>> ', e);
switch (e.props.name) {
// 日志跟踪
case 'tab2':
handleSignLoadScanLogs();
break;
default:
break;
}
};
/** 查看运单 */
const handleGoWaybillDetails = ({ row }) => {
console.log('row :>> ', row);
$router.push({
path: '/distribution/inventory/BookingNote',
query: {
name: `查看 -- 【${row.waybillNo}`,
waybillNo: row.waybillNo,
id: row.waybillId,
waybillType: row.waybillType,
},
});
};
/** 关闭页面 */
const back = () => {
$store.commit('DEL_TAG_CURRENT');
$router.push({ path: '/distribution/artery/TripartiteTransfer' });
};
watch($route, () => {
if ($route.path !== '/distribution/artery/TripartiteTransferDetails') return;
onLoad();
});
</script>
<style scoped lang="scss">
.fo-fl {
display: flex;
flex-wrap: wrap;
zoom: 0.9;
> div {
min-width: 25%;
margin-right: 0px;
padding: 0 10px;
box-sizing: border-box;
&:nth-child(4n) {
padding-right: 0;
}
}
}
// 日期选择器
:deep(.el-date-editor.el-input) {
height: 100% !important;
width: 100% !important;
}
:deep(.el-range-editor.el-input__wrapper) {
height: 100% !important;
}
:deep(.el-select) {
width: 100%;
}
:deep(.el-input-number) {
width: 100%;
}
.pointer {
cursor: pointer;
}
// 页面底部站位
.footer {
height: 80px;
}
// 提交按钮
.button-container {
z-index: 99;
position: fixed;
bottom: 30px;
left: 50%;
}
// 标题
:deep(.el-divider__text.is-left) {
font-size: 20px;
font-weight: bold;
color: var(--el-color-primary);
}
.mr10 {
margin-right: 10px;
height: 40px;
}
:deep(.el-table__row) {
height: 30px;
}
:deep(.slotbuts) {
height: 30px;
.el-input-number {
height: 100%;
}
}
// 禁用样式
:deep(.el-input.is-disabled .el-input__wrapper) {
background-color: #fff;
color: #000 !important;
-webkit-text-fill-color: #000 !important;
}
:deep(.el-input.is-disabled .el-input__inner) {
color: #000 !important;
-webkit-text-fill-color: #000 !important;
text-align: left;
}
:deep(.el-textarea.is-disabled .el-textarea__inner) {
background-color: #fff;
color: #000 !important;
}
</style>