emis-frontend/src/views/emis/emisTmsSiteBatch/panel/BigBatchListPanel.vue
2024-12-26 07:55:49 +08:00

860 lines
27 KiB
Vue

<template>
<XdPageContainer>
<!-- <el-form slot="pageHeader" ref="form" size="mini" :model="queryParams" label-width="100px"> -->
<SearchForm slot="pageHeader" class="queryForm" :model="queryParams" ref="queryForm" size="mini" :maxShow="9" label-width="100px" v-show="showSearch" @search="handleQuery" @reset="resetQuery">
<el-row :gutter="0" style="display: flex;flex-wrap: wrap;">
<el-col :span="8">
<el-form-item label="" prop="queryOrderType">
<div slot="label">
<el-radio-group class="query-label" v-model="queryOrderType">
<el-radio label="1">运单号</el-radio>
<el-radio label="0">批次号</el-radio>
</el-radio-group>
</div>
<XdTextareaInput
v-model="queryParams.queryKey"
:placeholder="$t('多个流水号逗号或换行隔开')"
clearable
:rows="2"
/>
</el-form-item>
<el-form-item label="创建时间" prop="dateTimeRange">
<elDateAdvPicker clearable v-model="dateTimeRange" style="width:260px" ></elDateAdvPicker>
</el-form-item>
</el-col>
<el-col :span="16">
<el-form-item label="批次名称" prop="batchName">
<el-input
v-model="queryParams.batchName"
:placeholder="$t('批次名称')"
clearable
/>
</el-form-item>
<el-form-item label="运输方式" prop="transType">
<el-select v-model="queryParams.transType" placeholder="运输方式" clearable filterable >
<el-option
v-for="dict in dict.type.emis_biz_shipping_method"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="起始网点" prop="startSiteCode">
<EmisSiteSimplePicker :placeholder="$t('请选择')" v-model="queryParams.startSiteCode" ></EmisSiteSimplePicker>
</el-form-item>
<el-form-item label="下一网点" prop="nextSiteCode">
<EmisSiteSimplePicker :placeholder="$t('请选择')" v-model="queryParams.nextSiteCode" ></EmisSiteSimplePicker>
</el-form-item>
<el-form-item label="运输号" prop="carNo">
<el-input
v-model="queryParams.carNo"
:placeholder="$t('运输号')"
clearable
/>
</el-form-item>
<el-form-item label="目的国" prop="destCountry">
<CountryPicker :placeholder="$t('目的国')" v-model="queryParams.destCountry" ></CountryPicker>
</el-form-item>
</el-col>
</el-row>
</SearchForm>
<XdTable
v-loading="loading"
slot="pageContent"
slot-scope="slotProps"
:height="(slotProps.contentHeight)+'px'"
ref="refTable"
storageName="BigBatchPanel_main_241116"
border
size="mini"
:data="emisTmsBatchList"
:showSearch.sync="showSearch"
:queryParams="queryParams"
:total="total"
@queryTable="getList"
@selection-change="handleSelectionChange"
@sort-change="handleSortChange"
@row-dblclick="handleShowBatchInfo"
>
<div slot="toolbar">
<!-- <el-button style="margin-right: 5px;"
type="primary"
plain
size="mini"
v-hasPermi="['emis:emisTmsSiteBatch:query']"
@click="getList"
>查询</el-button> -->
<el-button style="margin-right: 5px;"
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['emis:emisTmsSiteBatch:add']"
>新组批次</el-button>
<el-button style="margin-right: 5px;"
type="danger"
plain
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['emis:emisTmsSiteBatch:edit']"
>修改批次</el-button>
<el-button style="margin-right: 5px;"
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['emis:emisTmsSiteBatch:remove']"
>删除</el-button>
<el-button
style="margin-right: 5px;"
type="warning"
plain
:disabled="multiple"
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出</el-button>
<el-button style="margin-right: 5px;"
type="warning"
plain
:disabled="single"
icon="el-icon-download"
size="mini"
@click="handleDownBatchDtl"
>导出批次明细</el-button>
</div>
<el-table-column type="selection" width="55" align="center" />
<el-table-column :label="$t('批次号')" align="center" prop="batchNo" min-width="100" />
<el-table-column :label="$t('批次名称')" align="center" prop="batchName" min-width="130" :show-overflow-tooltip="true" />
<el-table-column :label="$t('批次类型')" align="center" prop="batchType" min-width="100">
<template slot-scope="scope">
<span v-if="scope.row.batchType==1">一程批次</span>
<span v-else-if="scope.row.batchType==2">二程批次</span>
<span v-else-if="scope.row.batchType==3">网点互寄</span>
<span v-else-if="scope.row.batchType==4">三程批次</span>
</template>
</el-table-column>
<!-- <el-table-column :label="$t('报关资料状态')" align="center" prop="declareResStatus" min-width="170">
<template slot-scope="scope">
<el-tag v-if="scope.row.declareResStatus==1" type="success">{{ $t('已上传') }}</el-tag>
<el-tag v-else-if="scope.row.declareResStatus==0" type="warning">{{ $t('未上传') }}</el-tag>
</template>
</el-table-column>
<el-table-column :label="$t('清关资料状态')" align="center" prop="clearanceResStatus" min-width="170">
<template slot-scope="scope">
<el-tag v-if="scope.row.declareResStatus==1" type="success">{{ $t('已上传') }}</el-tag>
<el-tag v-else-if="scope.row.declareResStatus==0" type="warning">{{ $t('未上传') }}</el-tag>
</template>
</el-table-column> -->
<el-table-column :label="$t('运输方式')" align="center" prop="transType" min-width="80">
<template slot-scope="scope">
<dict-tag :options="dict.type.emis_biz_shipping_method" :value="scope.row.transType"/>
</template>
</el-table-column>
<el-table-column :label="$t('运输号')" align="center" prop="carNo" min-width="170">
<template slot-scope="scope">
{{scope.row.carNo}}
</template>
</el-table-column>
<el-table-column :label="$t('承运重量')" align="center" prop="transWeight" min-width="100" />
<el-table-column :label="$t('包裹数')" align="center" prop="packNum" min-width="100" />
<el-table-column :label="$t('发出时间')" align="center" prop="etd" min-width="100" >
<template slot-scope="scope">
<span>{{ parseTime(scope.row.etd, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<!-- <el-table-column :label="$t('异常信息')" align="center" prop="remark" min-width="170">
<template slot-scope="scope">
<span class="ellipsis">{{ scope.row.remark }}</span>
</template>
</el-table-column> -->
<el-table-column :label="$t('起始网点')" align="center" prop="startSiteName" min-width="150" />
<el-table-column :label="$t('下一网点')" align="center" prop="nextSiteName" min-width="150" />
<el-table-column :label="$t('目的国家')" align="center" prop="destCountryName" min-width="100"/>
<el-table-column :label="$t('总票数')" align="center" prop="totalWaybillQty" min-width="100" />
<el-table-column :label="$t('总件数')" align="center" prop="totalParcelQty" min-width="100" />
<el-table-column :label="$t('总重量(kg)')" align="center" prop="totalWeight" min-width="100" />
<el-table-column :label="$t('创建时间')" align="center" prop="createTime" min-width="170"/>
<el-table-column :label="$t('操作员')" align="center" prop="createByName" min-width="150" />
</XdTable>
</XdPageContainer>
</template>
<script>
import { listEmisTmsSiteBatch, getTmsGroupBatchNo, getEmisTmsSiteBatch, delEmisTmsSiteBatch, addEmisTmsSiteBatch, updateEmisTmsSiteBatch } from "@/api/emis/emisTmsSiteBatch";
import emisTmsPackForm from '@/views/emis/emisTmsPack/emisTmsPackForm';
import elDateAdvPicker from '@/components/DatePickerAdv/elDateAdvPicker';
import CountryPicker from '@/views/emis/EmisBaseTools/CountryPicker.vue';
import EmisSiteSimplePicker from '@/views/emis/EmisBaseTools/EmisSiteSimplePicker.vue';
import EmisGetNextSitePicker from '@/views/emis/EmisBaseTools/EmisGetNextSitePicker.vue';
import TransProductPicker from '@/views/emis/EmisBaseTools/TransProductPicker.vue';
import TransLinePicker from '@/views/emis/EmisBaseTools/TransLinePicker.vue';
import { parseTime, dateToStr } from "@/utils/custom";
import { formatSearchStr } from '@/utils/index'
import { listEmisTmsSiteBatchDtl} from "@/api/emis/emisTmsSiteBatchDtl";
import PackListView from '@/views/emis/emisTmsSiteBatch/packListView';
export default {
name: "CenterGenBatchMgnt",
components: { EmisGetNextSitePicker, CountryPicker, EmisSiteSimplePicker, elDateAdvPicker, emisTmsPackForm, TransLinePicker, TransProductPicker, PackListView},
dicts: [
'emis_waybill_status', 'emis_payment_type', 'emis_biz_shipping_method', 'emis_qujian_fangshi', 'cebp_return_status','emis_declare_mode','emis_customs_clear',
],
data() {
return {
// 遮罩层
loading: false,
loading2: false,
loadingWait: false,
loadingDone: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
coSingle: true,
coMultiple: true,
addWayBillDisabled: true,
// packDisabled: true,
activeName:'third',
// 显示搜索条件
showSearch: true,
// 创建时间搜索
dateTimeRange:[],
// 总条数
total: 0,
// TMS组批次表格数据
emisTmsBatchList: [],
// 待组批次列表
emisTmsWaitPackList:[],
waitTotal:0,
// 已组批次列表
emisTmsDonePackList:[],
doneTotal:0,
waitPackList:[],//选择未组包的运单先保存起来,在后续新增组批次的弹框中使用
// 新增/修改弹窗数据
coData: {
},
openBatch: false,
titleBatch: "",
formBatchBillList:"",
// 新增/修改包详情数据
emisCoPackDetail:[],
blUnpack:"1",
// 追加的运单查询数据
wayBillData: {
pageNum: 1,
pageSize: 20,
params:{
dataTimeType: '1',
queryOrderType: '1'
}
},
// 追加的运单数据
emisWayBillList:[],
selectionList:[],
wayBillotal:0,
currentId:null,
openForm: false,
titleForm: "",
queryOrderType:'1',
titleWayBill:null,
openWayBillForm:false,
tempCoPackList:[],
coSelection:[],
//区分当前是新增还是修改
coPackType:'',
// 临时存储已有组批次的运单号
tempExistCoPackWayBillList:[],
tempCoPackInfo:{},
// 弹出展示层
id:null,
titleView:"",
openView: false,
// 更新网点时间范围
daterangeCreateTime: [],
// 更新网点时间范围
daterangeUpdateTime: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 20,
queryKey:null,
batchNo: null,
batchName: null,
transType: null,
startSiteCode: null,
nextSiteCode: null,
carNo: null,
destCountry: null,
params:{
queryOrderType: '1',
billCode: null
},
},
queryCoParams: {
params:{}
},
// 查询参数
queryWaitParams: {
pageNum: 1,
pageSize: 20,
packNo: null,
beginCreateTime: null,
endCreateTime: null,
params:{}
},
// 查询参数
queryDoneParams: {
pageNum: 1,
pageSize: 20,
packNo: null,
params:{}
},
};
},
created() {
},
mounted() {
const end = new Date()
const start = new Date()
start.setHours(0,0,0,0)
end.setHours(23,59,59,0)
this.dateTimeRange=[start,end];
this.getList();
},
methods: {
/** 查询TMS组批次列表 */
getList() {
this.loading = true;
let rqParams = {...this.queryParams};
if(this.queryParams.queryKey){
rqParams={
pageNum: this.queryParams.pageNum,
pageSize: this.queryParams.pageSize,
queryKey:null,
params:{
billCode:null,
batchNo:null
}
};
if(this.queryOrderType=='1'){
rqParams.params.billCode=this.queryParams.queryKey;
rqParams.batchNo=null;
}else{
rqParams.batchNo=this.queryParams.queryKey;
rqParams.params.billCode=null;
}
}else{
rqParams=this.addDateRange(rqParams, this.dateTimeRange,"createTime");
}
listEmisTmsSiteBatch(rqParams).then(response => {
this.emisTmsBatchList = response.rows;
this.total = response.total;
this.loading = false;
});
},
initQueryParams(){
this.queryParams=this.addDateRange(this.queryParams, this.dateTimeRange,"createTime");
return this.queryParams;
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.selection = selection;
this.selectionList=selection;
this.single = selection.length!==1
this.multiple = !selection.length
},
// 排序 查询字段是表格中字段名字 动态取值排序顺序
handleSortChange(column) {
this.queryParams.orderByColumn = column.prop;
this.queryParams.isAsc = column.order;
this.getList();
},
/** 新增按钮操作 */
handleAdd() {
this.$emit("onCreate");
},
handleDelete(row){
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除').then(function() {
return delEmisTmsSiteBatch(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 修改按钮操作 */
handleUpdate() {
// let id = this.ids[0]
this.$emit("onUpdate",this.ids);
},
handleShowBatchInfo(row){
this.$emit("onView",row.id);
},
handleFormChanged(){
this.openForm = false;
this.getList();
},
cancelForm(){
this.openForm = false;
},
/** 导出按钮操作 */
handleExport() {
const loadingInstance = this.$loading({
text: '正在导出...'
})
if(this.selectionList&&this.selectionList.length>0){
this.exportData(this.selectionList,loadingInstance);
}
else{
let qExportParam=this.initQueryParams();
qExportParam.pageNum=1;
qExportParam.pageSize=20000;
listEmisTmsSiteBatch(qExportParam).then(response => {
if (response.code === 200) {
this.exportData(response.rows,loadingInstance);
}
});
}
},
exportData(selData,loadingInstance){
const curList =selData
import('@/vendor/Export2Excel').then(excel => {
const exportParam=this.$refs.refTable.getExportParam();
const tHeader = exportParam.header;
const filterVal = exportParam.filter;
const data = this.formatJson(filterVal, curList, selData)
excel.export_json_to_excel({
header: tHeader,
data,
filename: '批次列表',
autoWidth: true
})
loadingInstance.close()
})
},
formatJson(filterVal, jsonData, resData) {
let index = 0
return jsonData.map(v => filterVal.map(j => {
if (j === 'index') {
return ++index
}
if (j === 'kjlx') {
return v['sendSiteName']+'--'+v['dispatchUnderlingSiteName'];
}
if (j === 'fjr') {
return v['sendName']+'--'+v['receiveName'];
}
if (j === 'custName') {
let paymentType=v['paymentType'];
if(paymentType==2 || paymentType==4 || paymentType==5 ){
return v['custName'];
}else{
return "";
}
}
if (j === 'sendMobile') {
return "";
}
if (j === 'paymentStatus') {
return this.selectDictLabel(this.dict.type.emis_payment_status,v[j]);
}
if (j === 'pickupMethod') {
return this.selectDictLabel(this.dict.type.emis_qujian_fangshi,v[j]);
}
if (j === 'customsEclaration') {
return this.selectDictLabel(this.dict.type.emis_declare_mode,v[j]);
}
if (j === 'customsClear') {
return this.selectDictLabel(this.dict.type.emis_customs_clear,v[j]);
}
if (j === 'packType') {
return this.selectDictLabels(this.dict.type.emis_tab_packing_type,v[j]);
}
if (j === 'dispatchMethod') {
if(v[j] == 1){
return '派送';
}else{
return '自提';
}
}
if (j === 'blMessage') {
if(v[j] == 1){
return '发送';
}else{
return '不发送';
}
}
if (j === 'blAcceptMessage') {
if(v[j] == 1){
return '发送';
}else{
return '不发送';
}
}
if (j === 'blSign') {
if(v[j] == 1){
return '已签收';
}else{
return '未签收';
}
}
if (j === 'paymentType') {
return this.selectDictLabel(this.dict.type.emis_payment_type,v[j]);
}
return v[j]
}))
},
handleDownBatchDtl(batchName){
const loadingInstance = this.$loading({
text: '正在导出...'
})
if(this.selectionList&&this.selectionList.length>0){
this.selectionList.forEach(item=>{
let qExportParam={
pageNum:1,
pageSize:20000,
batchNo: item.batchNo
};
let batchName=item.batchNo;
listEmisTmsSiteBatchDtl(qExportParam).then(response => {
if (response.code === 200) {
this.exportDataDtl(batchName,response.rows,loadingInstance);
}
});
});
}
},
exportDataDtl(batchName,selData,loadingInstance){
const curList =selData
import('@/vendor/Export2Excel').then(excel => {
const tHeader = ['运单号','寄件国家','目的国家','线路','产品类型','预计到达时间','总件数','实际重量','总体积','体积重量','结算重量','收件人','收件公司','取件方式','付款方式','运费','寄件人','寄件公司','录单备注','寄件网点','清关方式','报关方式'];
const filterVal=[
"billCode",
"sendCountryName",
"receiveCountryName",
"transLineTypeName",
"productTypeName",
"estimateDate",
"parcelQty",
"billWeight",
"totalVolume",
"volumeWeight",
"settlementWeight",
"receiveName",
"receiveCompany",
"pickupMethod",
"paymentType",
"freight",
"sendName",
"sendCompany",
"remark",
"sendSiteName",
"customsEclaration",
"customsClear"
];
const data = this.formatJsonDtl(filterVal, curList, selData)
excel.export_json_to_excel({
header: tHeader,
data,
filename: batchName+'批次明细表',
autoWidth: true
})
loadingInstance.close()
})
},
formatJsonDtl(filterVal, jsonData, resData) {
let index = 0
return jsonData.map(v => filterVal.map(j => {
if (j === 'index') {
return ++index
}
if (j === 'kjlx') {
return v['waybillDetail']['sendSiteName']+'--'+v['waybillDetail']['dispatchUnderlingSiteName'];
}
if (j === 'fjr') {
return v['sendName']+'--'+v['receiveName'];
}
if (j === 'receiveCountryName') {
return v['waybillDetail']['receiveCountryName'];
}
if (j === 'sendCountryName') {
return v['waybillDetail']['sendCountryName'];
}
if (j === 'estimateDate') {
return v['waybillDetail']['estimateDate'];
}
if (j === 'sendSiteName') {
return v['waybillDetail']['sendSiteName'];
}
if (j === 'sendName') {
return v['waybillDetail']['sendName'];
}
if (j === 'receiveName') {
return v['waybillDetail']['receiveName'];
}
if (j === 'sendDate') {
return v['waybillDetail']['sendDate'];
}
if (j === 'sendCompany') {
return v['waybillDetail']['sendCompany'];
}
if (j === 'receiveCompany') {
return v['waybillDetail']['receiveCompany'];
}
if (j === 'transLineTypeName') {
return v['waybillDetail']['transLineTypeName'];
}
if (j === 'productTypeName') {
return v['waybillDetail']['productTypeName'];
}
if (j === 'sendName') {
return v['waybillDetail']['sendName'];
}
if (j === 'parcelQty') {
return v['waybillDetail']['parcelQty'];
}
if (j === 'billWeight') {
return v['waybillDetail']['billWeight'];
}
if (j === 'volumeWeight') {
return v['waybillDetail']['volumeWeight'];
}
if (j === 'totalVolume') {
return v['waybillDetail']['totalVolume'];
}
if (j === 'settlementWeight') {
return v['waybillDetail']['settlementWeight'];
}
if (j === 'freight') {
return v['waybillDetail']['freight'];
}
if (j === 'realFee') {
return v['waybillDetail']['realFee'];
}
if (j === 'remark') {
return v['waybillDetail']['remark'];
}
if (j === 'feeRemark') {
return v['waybillDetail']['feeRemark'];
}
if (j === 'salesmen') {
return v['waybillDetail']['salesmen'];
}
if (j === 'payee') {
return v['waybillDetail']['payee'];
}
if (j === 'payee') {
return v['waybillDetail']['payee'];
}
if (j === 'problemTypeName') {
return v['waybillDetail']['problemTypeName'];
}
if (j === 'problemCause') {
return v['waybillDetail']['problemCause'];
}
if (j === 'sendMobile') {
return "";
}
if (j === 'calcFeeType') {
return this.selectDictLabel(this.dict.type.emis_calc_fee_type,v['waybillDetail']['calcFeeType']);
}
if (j === 'waybillDetail.paymentStatus') {
return this.selectDictLabel(this.dict.type.emis_payment_status,v['waybillDetail']['paymentStatus']);
}
if (j === 'pickupMethod') {
return this.selectDictLabel(this.dict.type.emis_qujian_fangshi,v['waybillDetail']['pickupMethod']);
}
if (j === 'customsEclaration') {
return this.selectDictLabel(this.dict.type.emis_declare_mode,v['waybillDetail']['customsEclaration']);
}
if (j === 'customsClear') {
return this.selectDictLabel(this.dict.type.emis_customs_clear,v['waybillDetail']['customsClear']);
}
if (j === 'packType') {
return this.selectDictLabels(this.dict.type.emis_tab_packing_type,v['waybillDetail']['packType']);
}
if (j === 'dispatchMethod') {
if(v['waybillDetail']['dispatchMethod'] == 1){
return '派送';
}else{
return '自提';
}
}
if (j === 'blMessage') {
if(v['waybillDetail']['blMessage'] == 1){
return '发送';
}else{
return '不发送';
}
}
if (j === 'blAcceptMessage') {
if(v['waybillDetail']['blAcceptMessage'] == 1){
return '发送';
}else{
return '不发送';
}
}
if (j === 'blSign') {
if(v['waybillDetail']['blSign'] == 1){
return '已签收';
}else{
return '未签收';
}
}
if (j === 'paymentType') {
return this.selectDictLabel(this.dict.type.emis_payment_type,v['waybillDetail']['paymentType']);
}
return v[j]
}))
},
/** 列索引函数 */
getIndex($index) {
return (this.queryParams.pageNum - 1) * this.queryParams.pageSize + $index + 1
},
/** 时间搜索响应函数 */
dateTimeChange(value){
this.dateTimeRange=value;
},
}
};
</script>
<style scoped>
.el-divider{
margin-top: 0px;
background: 0 0;
border-top: 1px solid #E6EBF5;
}
.el-divider__text {
color: #0955ee;
cursor: pointer;
}
.query-label {
.el-radio{
display: block;
line-height: 23px;
white-space: normal;
margin-right: 0;
}
}
.overflowhidden{
overflow: hidden;
}
.ellipsis {
width: 100px;
overflow: hidden;
text-overflow: ellipsis;
vertical-align: top;
white-space: nowrap;
}
</style>