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.
 
 
 
 

1119 lines
30 KiB

<template>
<basic-container v-loading="details.loadingObj.pageLoading">
<div class="avue-crud">
<!-- 搜索模块 -->
<div v-h5uShow="search">
<!-- 查询模块 -->
<el-form :inline="true" :model="query" class="header_search">
<!-- <el-form-item label="有效状态">
<el-select v-model="query.value" clearable placeholder="有效状态">
<el-option label="有效" value="item.value" />
<el-option label="作废" value="item.value" />
</el-select>
</el-form-item> -->
<el-form-item label="运单号:" class="el-times">
<div class="el_div_input">
<el-input
v-model="query.waybillNoList"
clearable
placeholder="支持多运单查询,逗号拼接"
></el-input>
<el-icon class="el_dy_icon" @click="openDialog('运单号搜索', query.waybillNoList)"
><CirclePlusFilled
/></el-icon>
</div>
</el-form-item>
<el-form-item label="目的仓:">
<el-select
v-model="details.query.destinationWarehouseIds"
class="w100"
clearable
placeholder="请选择目的仓"
filterable
multiple
:reserve-keyword="false"
>
<el-option
v-for="value in details.warehouseOption"
:key="value.dictKey"
:label="value.dictValue"
:value="value.dictKey"
/>
</el-select>
</el-form-item>
<el-form-item label="制单时间:" class="el-times">
<el-date-picker
v-model="details.query.documentMakingTime"
type="daterange"
unlink-panels
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
:shortcuts="shortcuts"
value-format="YYYY-MM-DD"
clearable
/>
</el-form-item>
<el-form-item label="创建时间:" class="el-times">
<el-date-picker
v-model="details.query.createTime"
type="daterange"
unlink-panels
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
:shortcuts="shortcuts"
value-format="YYYY-MM-DD"
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 type="primary" icon="Printer" @click="batchPrint">打 印</el-button>
<el-button
type="primary"
v-if="permissionObj.WaybillOrderList_edit"
icon="Edit"
@click="editOrder"
>改 单</el-button
>
<!-- <el-button type="primary" icon="Plus" @click="searchChange">加入挑单夹</el-button> -->
<!-- <el-button type="primary" icon="Location" @click="searchChange">运单跟踪</el-button> -->
<el-button
type="primary"
icon="Delete"
v-if="permissionObj.WaybillOrderList_batchCancellation"
@click="handleBatchDelete"
>批量作废</el-button
>
<el-button
type="primary"
icon="Rank"
v-if="permissionObj.WaybillOrderList_freeze"
@click="handleBatchFreeze"
>冻 结</el-button
>
<el-button
type="primary"
icon="Refresh"
v-if="permissionObj.WaybillOrderList_recover"
@click="handleBatchRecover"
>恢 复</el-button
>
<!-- 导出 -->
<el-button
type="primary"
icon="Download"
v-if="permissionObj.WaybillOrderList_export"
@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="Search" @click="searchHide" circle></el-button>
</div>
</div>
<!-- 列表模块 -->
<tablecmt
ref="tableNodeRef"
:columnList="details.columnList"
:tableData="data"
:loading="loadingObj.list"
@inputTxt="inputsc"
@timeCheck="timesc"
@selectCheck="selectsc"
@selection="selectionChange"
:isselectfun="row => row.abolishStatus + '' !== '1'"
:tableRowClassName="
(row, index) => {
if (row.abolishStatus + '' === '1') return 'abolish';
else return '';
}
"
>
<template #default="slotProps">
<template v-if="slotProps.scope.column.label === '运单号'">
<el-text @click="handleGoWaybillDetails(slotProps.scope)">
{{ slotProps.scope.row.waybillNo }}
</el-text>
</template>
<template
v-else-if="
slotProps.scope.column.label === '操作' &&
// 作废
slotProps.scope.row.abolishStatus + '' !== '1' &&
// 冻结
slotProps.scope.row.freezeStatus + '' !== '1'
"
>
<el-text
@click="handleViewOrderDetails(slotProps.scope)"
v-if="permissionObj.WaybillOrderList_view"
>
查看订单
</el-text>
<el-text
@click="handleUploadReceipt(slotProps.scope)"
v-if="permissionObj.WaybillOrderList_uploadReceipt"
>
上传回单
</el-text>
</template>
</template>
</tablecmt>
<!-- 分页模块 -->
<div class="flex-c-sb">
<div style="font-size: 14px">勾选数量: {{ selectionList.length }}</div>
<!-- 分页模块 -->
<el-pagination
align="right"
background
@size-change="sizeChange"
@current-change="currentChange"
:current-page="page.currentPage"
:page-sizes="[30, 50, 80, 120]"
:page-size="page.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="page.total"
>
</el-pagination>
</div>
</div>
</basic-container>
<!-- 上传回单 -->
<el-dialog
class="el-dialog-view"
title="上传回单"
:visible.sync="details.popUpShow.view"
width="780px"
:show-close="false"
:fullscreen="details.fullscreenObj.view"
v-model="details.popUpShow.view"
>
<!-- 头部 -->
<template #header="{ close, titleId, titleClass }">
<div class="my-header flex-c-sb">
<div :id="titleId" :class="titleClass">上传回单</div>
<div class="flex-c-c">
<!-- 全屏显示按钮 -->
<el-button
type="text"
@click="handleFullScrean('open', 'el-dialog-view')"
v-if="!details.fullscreenObj.view"
>
<el-icon class=""><FullScreen /></el-icon>
</el-button>
<el-button type="text" @click="handleFullScrean('close', 'el-dialog-view')" v-else>
<el-icon class=""><CopyDocument /></el-icon>
</el-button>
<!-- 弹窗关闭按钮 -->
<el-button type="text">
<el-icon class="" @click="close"><Close /></el-icon>
</el-button>
</div>
</div>
</template>
<el-form label-width="100px">
<el-form-item label="运单号:">
<el-input readonly v-model="details.waybillNo"></el-input>
</el-form-item>
<el-form-item label="图片:">
<el-upload
v-model:file-list="details.fileList"
action="/api/blade-resource/oss/endpoint/put-file"
list-type="picture-card"
:on-preview="handlePictureCardPreview"
:before-upload="beforeAvatarUpload"
:headers="details.header"
:on-remove="handleRemove"
>
<el-icon><Plus /></el-icon>
</el-upload>
</el-form-item>
</el-form>
<div class="flex-c-c mt10">
<el-button @click="details.popUpShow.view = false">关闭</el-button>
<el-button type="primary" icon="Position" @click="handleUploadReceiptSubmit">提交</el-button>
</div>
</el-dialog>
<!-- 图片预览 -->
<el-dialog
v-model="details.popUpShow.dialogVisible"
width="fit-content"
:show-close="false"
:align-center="true"
class="imgDialogVisible"
>
<!-- <img w-full :src="details.dialogImageUrl" alt="Preview Image" /> -->
<el-image
:src="details.dialogImageUrl"
:preview-src-list="details.viewImgList"
:initial-index="details.viewImgIndex"
fit="cover"
/>
</el-dialog>
<!-- 打印 -->
<WaybillPrintTemplate
v-model="details.popUpShow.WaybillPrintTemplate"
:html="details.html"
width="fit-content"
/>
<MultiConditionSearch
v-model:modelValue="dialogVisible"
:title="popupTitle"
v-model:inputValue="searchInput"
@dialogSearchSubmit="handleSearchSubmit"
>
</MultiConditionSearch>
<!-- 列表配置显示 -->
<edittablehead
@closce="showdrawer"
:drawerShow="drawerShow"
:columnList="details.columnList"
v-model="details.columnList"
></edittablehead>
</template>
<script setup lang="ts">
import { ref, reactive, toRefs, computed, onMounted, nextTick } from 'vue';
import functions from '@/utils/functions.js';
import dayjs from 'dayjs';
import { mapGetters, useStore } from 'vuex';
/** 获取字典 */
import { getDictionaryBiz } from '@/api/system/dict';
import {
postWarehouseWaybillPageWaybillList,
postSaveWaybillReturn,
postPrintBatch,
postAbolishWaybill,
postFreezeWaybill,
postUnFreezeWaybill,
postExport,
} from '@/api/waybill/WaybillOrderList.js';
import { compressImageBlob } from '@/components/IMGcompressor/imgcompressor.js';
import MultiConditionSearch from '@/components/MultiConditionSearch/MultiConditionSearch.vue';
import {
downloadXls,
setNodeHeight,
getHtmls,
deepClone,
handleTranslationDataSeclect,
getObjType,
handleClearTableQuery,
} from '@/utils/util';
import { columnList } from '@/option/waybill/WaybillOrderList';
import { useRouter } from 'vue-router';
import print from '@/utils/print';
import { ElMessage, ElMessageBox } from 'element-plus';
import { getToken } from '@/utils/auth';
import { getListName } from '@/api/basicdata/basicdataVehicle';
import type { UploadProps, UploadUserFile } from 'element-plus';
import { utils } from 'sortablejs';
const $store = useStore();
// 获取路由实例
const $router = useRouter();
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];
},
},
],
/** 列表 */
columnList: deepClone(columnList),
/** 列表数据 */
data: [],
/** 页面loading */
loadingObj: {
/** 列表加载loading */
list: false,
packageListLoading: false,
/** 页面loading */
pageLoading: false,
},
/** 列表复选框选中的数据 */
selectionList: [],
/** 是否显示设置表格 */
drawerShow: false,
/** 分页参数 */
page: {
pageNum: 1,
pageSize: 30,
total: 0,
},
/** 弹出层显示 */
popUpShow: {
/** 上传回单 */
view: false,
/** 运单打印模版 */
WaybillPrintTemplate: false,
/** 图片预览 */
dialogVisible: false,
},
/** 列表Dom节点 */
listNode: '',
form: {},
/** 全屏 */
fullscreenObj: {
/** 查看 */
view: false,
},
/** 预览图片地址 */
dialogImageUrl: '',
/** 上传图片文件list */
fileList: [],
viewImgList: [],
viewImgIndex: 0,
waybillNo: '',
waybillId: '',
header: computed(() => {
return { 'Blade-Auth': 'Bearer ' + getToken() };
}),
html: '',
warehouseOption: [],
});
const tableNodeRef = ref();
const { search, query, shortcuts, data, loadingObj, selectionList, drawerShow, page, popUpShow } =
toRefs(details);
/** vuex */
const permission = computed(() => mapGetters(['permission', 'tagWel', 'tagList']));
console.log('permission :>> ', permission);
/** 权限按钮 */
const permissionObj = reactive({
/** 改单 */
WaybillOrderList_edit: computed(() => {
return $store.getters.permission.WaybillOrderList_edit;
}),
/** 批量作废 */
WaybillOrderList_batchCancellation: computed(() => {
return $store.getters.permission.WaybillOrderList_batchCancellation;
}),
/** 冻结 */
WaybillOrderList_freeze: computed(() => {
return $store.getters.permission.WaybillOrderList_freeze;
}),
/** 恢复 */
WaybillOrderList_recover: computed(() => {
return $store.getters.permission.WaybillOrderList_recover;
}),
/** 导出 */
WaybillOrderList_export: computed(() => {
return $store.getters.permission.WaybillOrderList_export;
}),
/** 查看订单 */
WaybillOrderList_view: computed(() => {
return $store.getters.permission.WaybillOrderList_view;
}),
/** 上传回单 */
WaybillOrderList_uploadReceipt: computed(() => {
return $store.getters.permission.WaybillOrderList_uploadReceipt;
}),
});
const dialogVisible = ref(false);
const popupTitle = ref('搜索弹窗');
const searchInput = ref('');
const openDialog = (title, input) => {
popupTitle.value = title;
console.log(input, 'input');
if (input) {
const formattedInput = input.split(',').join('\n');
searchInput.value = formattedInput; // 赋值给 inputAll
} else {
searchInput.value = '';
}
dialogVisible.value = true;
};
const handleSearchSubmit = value => {
if (popupTitle.value == '运单号搜索') {
query.value.waybillNoList = value; //搜索框值
}
dialogVisible.value = false;
};
/** 请求页面数据 */
const onLoad = async (page?: any, params = {}) => {
try {
details.loadingObj.list = true;
let _page = details.page;
if (page) _page = page;
const submitData = {
..._page,
...details.query,
...params,
};
// 创建时间
if (getObjType(details.query.createTime) === 'array' && details.query.createTime.length > 0) {
submitData.createTimeStartStr = details.query.createTime[0];
submitData.createTimeEndStr = details.query.createTime[1];
}
// 创建时间
if (
getObjType(details.query.documentMakingTime) === 'array' &&
details.query.documentMakingTime.length > 0
) {
submitData.documentMakingTimeStartStr = details.query.documentMakingTime[0];
submitData.documentMakingTimeEndStr = details.query.documentMakingTime[1];
}
if (getObjType(submitData.waybillNoList) === 'string' && submitData.waybillNoList) {
submitData.waybillNoList = submitData.waybillNoList.replaceAll(',', ',').split(',');
} else delete submitData.waybillNoList;
for (const key in submitData) {
const value = submitData[key];
if (getObjType(value) === 'string' && !value) delete submitData[key];
else if (getObjType(value) === 'array' && value.length === 0) delete submitData[key];
}
delete submitData.createTime;
delete submitData.documentMakingTime;
// 获取运单列表
const res = await postWarehouseWaybillPageWaybillList(submitData);
console.log('res :>> ', res);
const { code, data } = res.data;
if (code !== 200) return;
details.data = data.records;
handleTranslationDataSeclect(details.data, details.columnList);
console.log('details.data :>> ', details.data);
details.page.total = data.total;
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.list = false;
}
};
onLoad();
// 上传图片规则
const beforeAvatarUpload = async rawFile => {
console.log(rawFile);
if (rawFile.type !== 'image/png' && rawFile.type !== 'image/jpeg') {
ElMessage.error('图片格式只能为 png/jpg!');
return false;
} else if (rawFile.size / 1024 / 1024 > 10) {
ElMessage.error('图片大小不能大于10MB!');
return false;
}
const res = await compressImageBlob(rawFile);
return res;
};
/** 搜索 */
const searchChange = () => {
onLoad(details.page);
};
/** 清空表单 */
const searchReset = () => {
details.query = {};
details.page.currentPage = 1;
handleClearTableQuery(details.columnList);
onLoad(details.page);
};
/** 展开列表控件 */
const showdrawer = (_flag?: boolean) => {
details.drawerShow = _flag;
};
/** 是否开启搜索区 */
const searchHide = async () => {
details.search = !details.search;
await nextTick();
setNodeHeight(tableNodeRef.value.$el, '', true);
};
/** 表格表头输入框搜索 */
const inputsc = (index, row) => {
details.query[row.prop] = index;
if (!index && index !== 0) delete details.query[row.prop];
onLoad(details.page);
};
/** 表格表头时间选择 */
const timesc = (index, row) => {
console.log(index, row);
if (!!index) {
index = dayjs(index).format('YYYY-MM-DD');
}
if (!index && index !== 0) delete details.query[row.prop];
details.query[row.prop] = index;
if (!index) {
delete details.query[row.prop];
}
onLoad(details.page);
};
/** 表格表头下拉框选择 */
const selectsc = (index, row) => {
const _key = row.prop.replace('Name', '');
details.query[_key] = index;
if (!index && index !== 0) delete details.query[_key];
onLoad(details.page);
};
/** 表格表头复选框选择 */
const selectionChange = (list: any) => {
details.selectionList = list;
};
/** 每页数量改变执行的回调 */
const sizeChange = (pageSize: number) => {
details.page.pageSize = pageSize;
onLoad(details.page);
};
/** 页码改变执行的回调 */
const currentChange = current => {
details.page.pageNum = current;
onLoad();
};
/** 弹出层开启前清除数据 */
const beforeClose = done => {
done();
details.form = {};
details.selectionList = [];
details.view = false;
};
/** 上传回单 */
const handleUploadReceipt = ({ row }) => {
details.popUpShow.view = true;
details.fileList = [];
details.viewImgIndex = 0;
details.viewImgList = [];
details.waybillNo = row.waybillNo;
details.waybillId = row.id;
};
/** 查看订单详情 */
const handleViewOrderDetails = ({ row }) => {
$router.push({
path: '/waybill/orderDetails',
query: { id: row.id, name: `${row.waybillNo} -- 订单详情` },
});
};
/**
* 是否开启全屏
* @params(_type) 开启或关闭
*/
const handleFullScrean = (_type: 'open' | 'close', _name: string) => {
let _node: Element;
if (_name) _node = document.querySelector(`.${_name} .maboxhi`);
switch (_name) {
case 'el-dialog-view':
details.fullscreenObj.view = !details.fullscreenObj.view;
if (_type === 'close') {
if (_node) setNodeHeight(_node);
} else {
if (_node) setNodeHeight(_node);
}
break;
default:
details.fullscreenObj[_name] = !details.fullscreenObj[_name];
break;
}
};
/** 批量打印 */
const batchPrint = async () => {
if (details.selectionList.length === 0) {
return ElMessage({
type: 'warning',
message: '最少选择一条数据',
});
}
try {
details.loadingObj.pageLoading = true;
const res = await postPrintBatch({
ids: details.selectionList.map(val => val.id).join(','),
tempId: 16,
});
const { code, data } = res.data;
if (code !== 200 || !data || data.length === 0) return;
let _html = '';
if (getObjType(data) !== 'object') return;
for (const key in data) {
const element = data[key];
for (let i = 0; i < element.length; i++) {
const value = element[i];
let template = value.templateHtml;
// console.log('value.templateHtml :>> ', value.templateHtml);
// template = template.replace('第n页', `第${i + 1}页`);
// template = template.replace('共n页', `共${element.length}页`);
// template = template.replaceAll('0.00', ``);
_html += JSON.parse(JSON.stringify(template));
}
}
console.log('res :>> ', res);
details.html = _html;
details.popUpShow.WaybillPrintTemplate = true;
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
};
/** 改单 */
const editOrder = () => {
if (details.selectionList.length !== 1) {
return ElMessage({
type: 'warning',
message: '请选择一条进行改单数据',
});
}
const _item = details.selectionList[0];
if (Number(_item.checkStatus) === 1) return ElMessage.warning('该运单已审核,无法进行改单操作');
if (Number(_item.waybillType) === 1 || _item.orderNo) {
$store.commit('DEL_ONCE_TAG', '/distribution/inventory/CreateOrder');
// 暂存单转运单的数据
$router.push({
path: '/distribution/inventory/CreateOrder',
query: {
name: '改单',
id: _item.id,
type: 'edit',
backPath: '/waybill/WaybillOrderList',
orderStatus: Number(_item.waybillType) === 1 ? 'haveData' : 'notHaveData',
},
});
} else if (Number(_item.waybillType) === 2) {
// 零担开单的数据
$store.commit('DEL_ONCE_TAG', '/waybill/CreateZeroOrder');
$router.push({
path: '/waybill/CreateZeroOrder',
query: {
name: '改单',
id: _item.id,
type: 'edit',
backPath: '/waybill/WaybillOrderList',
},
});
}
};
/** 批量作废 */
const handleBatchDelete = () => {
if (details.selectionList.length === 0) {
return ElMessage({
type: 'warning',
message: '最少选择一条数据',
});
}
ElMessageBox.prompt('作废原因', '确定要批量作废吗?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputErrorMessage: '请输入作废原因',
inputValidator(value) {
return Boolean(value);
},
type: 'warning',
}).then(async ({ value }) => {
try {
details.loadingObj.pageLoading = true;
const res = await postAbolishWaybill({
waybillIds: details.selectionList.map(val => val.id),
abolishReson: value,
});
console.log('res :>> ', res);
if (res.data.code !== 200) return;
ElMessage({
type: 'success',
message: '批量作废成功',
});
details.selectionList = [];
onLoad();
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
});
};
/** 批量冻结 */
const handleBatchFreeze = () => {
if (details.selectionList.length === 0) {
return ElMessage({
type: 'warning',
message: '最少选择一条数据',
});
}
ElMessageBox.confirm('确定要批量冻结吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(async () => {
try {
details.loadingObj.pageLoading = true;
const res = await postFreezeWaybill({
waybillIds: details.selectionList.map(val => val.id),
});
console.log('res :>> ', res);
if (res.data.code !== 200) return;
ElMessage({
type: 'success',
message: '批量冻结成功',
});
details.selectionList = [];
onLoad();
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
});
};
/** 批量恢复 */
const handleBatchRecover = () => {
if (details.selectionList.length === 0) {
return ElMessage({
type: 'warning',
message: '最少选择一条数据',
});
}
ElMessageBox.confirm('确定要批量恢复吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(async () => {
try {
details.loadingObj.pageLoading = true;
const res = await postUnFreezeWaybill({
waybillIds: details.selectionList.map(val => val.id),
});
console.log('res :>> ', res);
if (res.data.code !== 200) return;
ElMessage({
type: 'success',
message: '批量恢复成功',
});
details.selectionList = [];
onLoad();
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
});
};
/** 查看运单 */
const handleGoWaybillDetails = ({ row }) => {
if (row.waybillNo === '————' || !row.id) return ElMessage.warning('暂无运单号');
console.log('row :>> ', row);
$router.push({
path: '/distribution/inventory/BookingNote',
query: {
name: `查看 -- 【${row.waybillNo}】`,
waybillNo: row.waybillNo,
id: row.id,
waybillType: row.waybillType,
},
});
};
/** 图片删除 */
const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => {
console.log(uploadFile, uploadFiles);
};
/** 已上传的文件 */
const handlePictureCardPreview: UploadProps['onPreview'] = uploadFile => {
details.viewImgList = details.fileList.map(val => val.url);
details.viewImgIndex = details.viewImgList.indexOf(uploadFile.url);
details.dialogImageUrl = uploadFile.url!;
details.popUpShow.dialogVisible = true;
};
const handleUploadReceiptSubmit = async () => {
let content = '';
if (!details.waybillNo) content = '运单号不能为空';
else if (details.fileList.length === 0) content = '请上传图片';
if (content) return ElMessage.warning({ message: content });
details.loadingObj.pageLoading = true;
details.popUpShow.view = false;
try {
const imgUrlList = [];
for (let i = 0; i < details.fileList.length; i++) {
const value = details.fileList[i];
imgUrlList.push(value.response.data.link);
}
const submitData = {
waybillId: details.waybillId,
url: imgUrlList.join(','),
};
const res = await postSaveWaybillReturn(submitData);
const { code, data } = res.data;
if (code !== 200) return ElMessage.error({ message: '上传失败' });
ElMessage.success({ message: '上传成功' });
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
};
/** 导出 */
const handleExport = () => {
ElMessageBox.confirm('确定导出吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(async () => {
try {
details.loadingObj.pageLoading = true;
const submitData = { ...details.query };
// 创建时间
if (getObjType(details.query.createTime) === 'array' && details.query.createTime.length > 0) {
submitData.createTimeStartStr = details.query.createTime[0];
submitData.createTimeEndStr = details.query.createTime[1];
}
// 创建时间
if (
getObjType(details.query.documentMakingTime) === 'array' &&
details.query.documentMakingTime.length > 0
) {
submitData.documentMakingTimeStartStr = details.query.documentMakingTime[0];
submitData.documentMakingTimeEndStr = details.query.documentMakingTime[1];
}
if (getObjType(submitData.waybillNoList) === 'string' && submitData.waybillNoList) {
submitData.waybillNoList = submitData.waybillNoList.replaceAll(',', ',').split(',');
} else delete submitData.waybillNoList;
for (const key in submitData) {
const value = submitData[key];
if (getObjType(value) === 'string' && !value) delete submitData[key];
else if (getObjType(value) === 'array' && value.length === 0) delete submitData[key];
}
delete submitData.createTime;
delete submitData.documentMakingTime;
if (details.selectionList.length > 0)
submitData.ids = details.selectionList.map(val => val.id).join(',');
const res = await postExport(submitData);
console.log('res :>> ', res);
const { status, data } = res;
if (status !== 200) return ElMessage.error({ message: '导出失败' });
console.log('data :>> ', data);
downloadXls(data, '运单数据.xlsx');
} catch (error) {
console.log('error :>> ', error);
} finally {
details.loadingObj.pageLoading = false;
}
});
};
/** 初始化请求仓库数据 */
getListName({ name: '' }).then(res => {
const { code, data } = res.data;
if (code !== 200 || getObjType(data) !== 'array') return;
details.warehouseOption = data.map(val => {
return {
dictKey: val.id,
dictValue: val.name,
};
});
});
</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;
}
.view_row {
display: flex;
flex-wrap: wrap;
border: 1px solid #e6e6e6;
> div {
width: 33.33%;
flex: none;
border: 1px solid #e6e6e6;
box-sizing: border-box;
padding: 5px 10px;
}
}
:deep(.el-table tr) {
// 作废样式
&.abolish {
.tabculconte,
.el-tooltip,
.el-button--text,
.el-text {
// color: #e54b4b !important;
color: #f00 !important;
}
}
// &.hover-row {
// .tabculconte,
// .el-tooltip,
// .el-button--text {
// color: var(--el-color-primary) !important;
// }
// }
}
:deep(.header_search) {
align-items: start;
}
.el_div_input {
width: 100%;
display: flex;
align-items: center;
.el_dy_icon {
font-size: 1.5em;
}
}
</style>
<style>
.imgDialogVisible .el-dialog__header {
padding: 0;
}
.imgDialogVisible .el-dialog__body {
padding: 0;
}
</style>