emis-frontend/src/views/emis/emisTmsScanRecord/signatureAbnormalComparison.vue
2024-06-04 16:01:12 +08:00

704 lines
25 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="app-container">
<el-row :gutter="20">
<!-- <search-form :model="queryParams" ref="queryForm" size="small" :maxShow="8" label-width="68px" v-show="showSearch" @search="handleQuery" @reset="resetQuery"> -->
<el-form ref="queryForm" size="mini" :model="queryParams" :rules="rules" label-width="100px">
<el-col :span="16">
<el-col :span="16">
<el-form-item label="扫描时间" prop="dateTimeRange">
<elDateAdvPicker clearable v-model="dateTimeRange" @dateTimeChange="onDateSelect" ></elDateAdvPicker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('扫描站点')" prop="scanSiteCode" label-width="70px">
<EmisSiteSimplePicker v-model="queryParams.scanSiteCode" @onChange="onScanSiteSelect" ></EmisSiteSimplePicker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('扫描类型')" prop="scanType">
<el-select v-model="queryParams.scanType" :placeholder="$t('全部')" value="0">
<el-option :label="$t('派件')" value="1"></el-option>
<el-option :label="$t('到件')" value="2"></el-option>
<el-option :label="$t('发件')" value="3"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('上/下一网点')" prop="preOrNextStationCode" label-width="90px">
<EmisSiteSimplePicker v-model="queryParams.preOrNextStationCode" @onChange="onPreOrNextSiteSelect" ></EmisSiteSimplePicker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('扫描人')" prop="scanManCode">
<EmisUserSimplePicker v-model="queryParams.scanManCode" postCode="RSD" @onChange="onStaffSelect" ></EmisUserSimplePicker>
</el-form-item>
</el-col>
<el-col :span="16">
<el-form-item :label="$t('')" prop="thisSiteScanType" label-width="70px">
<el-radio-group v-model="queryParams.params.thisSiteScanType">
<el-radio :label="20">本站发件</el-radio>
<el-radio :label="30">本站到件</el-radio>
<el-radio :label="40">本站派件</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-col>
</el-form>
<!-- </search-form> -->
</el-row >
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="统计数据" name="first">
<xd-table v-loading="loading"
border stripe
size="small"
:data="emisStatList"
:showSearch.sync="showSearch"
:queryParams="queryParams"
:total="total"
@selection-change="handleSelectionChange"
@sort-change="handleSortChange"
v-if="tableHeight" :max-height="tableHeight + 'px'"
>
<div slot="toolbar">
<el-row :gutter="10" class="mb8">
<!-- <el-col :span="1.5">
<el-button
type="primary"
plain
size="mini"
@click="getList"
>查询</el-button>
</el-col> -->
<el-col :span="1.5">
<el-button
type="primary"
plain
size="mini"
@click="getList"
>导出</el-button>
</el-col>
</el-row>
</div>
<el-table-column type="selection" width="55" align="center" />
<el-table-column :label="$t('网点名称')" align="center" prop="scanSiteName" min-width="100" />
<el-table-column :label="$t('扫描票数')" align="center" prop="scanCount" min-width="150" />
<el-table-column :label="$t('已签收票数')" align="center" prop="signCount" min-width="150" />
<el-table-column :label="$t('未签收票数')" align="center" prop="destName" min-width="150">
<template slot-scope="scope">
<span>{{ (scope.row.scanCount - scope.row.signCount) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('签收率')" align="center" prop="registerSite" min-width="100">
<template slot-scope="scope">
<span>{{ ((scope.row.signCount / scope.row.scanCount) * 100).toFixed(2) + '%' }}</span>
</template>
</el-table-column>
</xd-table>
</el-tab-pane>
<el-tab-pane label="明细数据" name="second">
<xd-table v-loading="loading"
border stripe
size="small"
:data="emisStatRecordList"
:showSearch.sync="showSearch"
:queryParams="queryParams"
:total="recordTotal"
@selection-change="handleSelectionChange"
@sort-change="handleSortChange"
v-if="tableHeight" :max-height="tableHeight + 'px'"
>
<div slot="toolbar">
<el-row :gutter="10" class="mb8">
<!-- <el-col :span="1.5">
<el-button
type="primary"
plain
size="mini"
@click="getList"
>查询</el-button>
</el-col> -->
<el-col :span="1.5">
<el-button
type="primary"
plain
size="mini"
@click="getList"
>导出</el-button>
</el-col>
</el-row>
</div>
<el-table-column type="selection" width="55" align="center" />
<el-table-column :label="$t('运单号')" align="center" prop="billCode" min-width="170" />
<el-table-column :label="$t('扫描时间')" align="center" prop="scanDate" min-width="170" >
<template slot-scope="scope">
<span>{{ parseTime(scope.row.scanDate) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('扫描类型')" align="center" prop="scanType" min-width="100" >
<template slot-scope="scope">
<dict-tag :options="dict.type.emis_scan_type" :value="scope.row.scanType"/>
</template>
</el-table-column>
<el-table-column :label="$t('上/下一站')" align="center" prop="preOrNextStation" min-width="150">
<template slot-scope="scope">
<span>{{ (scope.row.preOrNextStation) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('扫描网点')" align="center" prop="scanSite" min-width="100">
<template slot-scope="scope">
<span>{{ (scope.row.scanSite) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('扫描人')" align="center" prop="scanMan" min-width="100">
<template slot-scope="scope">
<span>{{ (scope.row.scanMan) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('扫描人编号')" align="center" prop="scanManCode" min-width="100">
<template slot-scope="scope">
<span>{{ (scope.row.scanManCode) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('目的地')" align="center" prop="destinationName" min-width="100">
<template slot-scope="scope">
<span>{{ (scope.row.destinationName) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('寄件网点')" align="center" prop="registerSiteName" min-width="100">
<template slot-scope="scope">
<span>{{ (scope.row.registerSiteName) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('目的网点')" align="center" prop="dispatchUnderlingSiteName" min-width="100">
<template slot-scope="scope">
<span>{{ (scope.row.dispatchUnderlingSiteName) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('件数')" align="center" prop="parcelQty" min-width="100">
<template slot-scope="scope">
<span>{{ (scope.row.waybillDetail.parcelQty) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('实际重量')" align="center" prop="billWeight" min-width="100">
<template slot-scope="scope">
<span>{{ (scope.row.waybillDetail.billWeight) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('子单号')" align="center" prop="billCodeSub" min-width="170">
<template slot-scope="scope">
<span class="ellipsis">{{ (scope.row.waybillDetail.billCodeSub) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('产品类型')" align="center" prop="productTypeName" min-width="100">
<template slot-scope="scope">
<span>{{ (scope.row.waybillDetail.productTypeName) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('预计送达时间')" align="center" prop="estimateDate" min-width="170">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.waybillDetail.estimateDate) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('收件人')" align="center" prop="receiveName" min-width="100">
<template slot-scope="scope">
<span>{{ (scope.row.waybillDetail.receiveName) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('收件电话')" align="center" prop="receiveMobile" min-width="100">
<template slot-scope="scope">
<span>{{ (scope.row.waybillDetail.receiveMobile) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('收件地址')" align="center" prop="receiveAddress" min-width="100">
<template slot-scope="scope">
<span class="ellipsis">{{ (scope.row.waybillDetail.receiveAddress) }}</span>
</template>
</el-table-column>
</xd-table>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import { listEmisTmsScanRecord, queryStatList, queryScanStatRecordList } from "@/api/emis/emisTmsScanRecord";
import { doScan } from "@/api/emis/emisTmsScanRecord";
import elDateAdvPicker from '@/components/DatePickerAdv/elDateAdvPicker';
import EmisSiteSimplePicker from '@/views/emis/EmisBaseTools/EmisSiteSimplePicker.vue';
import EmisGetNextSitePicker from '@/views/emis/EmisBaseTools/EmisGetNextSitePicker.vue';
import CountryPicker from '@/views/emis/EmisBaseTools/CountryPicker.vue';
import EmisUserSimplePicker from '@/views/emis/EmisBaseTools/EmisUserSimplePicker.vue';
import { getDateTimeToString } from '@/utils/payutils'
import {dateToStr} from '@/utils/custom'
export default {
name: "SignatureAbnormalComparison",
components: { EmisUserSimplePicker,elDateAdvPicker, EmisSiteSimplePicker, EmisGetNextSitePicker, CountryPicker },
dicts: ['emis_scan_type'],
data() {
return {
// 调整表格的高度,不允许滚动
tableHeight: 200,
// 遮罩层
loading: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 创建时间搜索
dateTimeRange:[],
// 总条数
total: 0,
recordTotal:0,
// 网点电子面单申请表格数据
emisStatList: [],
emisStatRecordList:[],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
activeName: 'first',
openForm: false,
titleForm: "",
titleEmisElectronicPagApply: "",
openEmisElectronicPagApply: false,
// 显示编辑框更多
moreInputVisible: false,
dataMap:new Map(),
// 弹出展示层
currentId:null,
id:null,
titleView:"",
openView: false,
// 备注时间范围
daterangeApplyDate: [],
// 备注时间范围
daterangeCreateTime: [],
// 备注时间范围
daterangeUpdateTime: [],
// 查询参数
queryParams: {
pageNum:1,
pageSize:20,
scanType:null,
scanSiteCode:null,
preOrNextStationCode:null,
scanManCode:null,
params:{
thisSiteScanType:null,
beginScanDate:null,
endScanDate:null,
},//扩展参数
},
// 表单参数
form: {},
// 表单校验
rules: {
id: [
{ required: true, message: "id不能为空", trigger: "blur" }
],
}
};
},
created() {
// this.getList();
this.$nextTick(function() {
let queryFormEl = this.$refs.queryForm.$el;
let tableH = queryFormEl.offsetHeight+190;
this.tableHeight = window.innerHeight - tableH;
});
},
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: {
handleClick(){
if(this.activeName=="first"){
this.getList();
}else if(this.activeName=="second"){
this.getDetailList();
}
},
/** 查询统计信息 */
getList() {
this.loading = true;
console.log("---->this.queryParams,", this.dateTimeRange);
if (null != this.dateTimeRange && '' != this.dateTimeRange) {
this.queryParams.params.beginScanDate = dateToStr(this.dateTimeRange[0]);
this.queryParams.params.endScanDate = dateToStr(this.dateTimeRange[1]);
}else{
this.queryParams.params.beginScanDate = null;
this.queryParams.params.endScanDate = null;
}
queryStatList(this.queryParams).then(response => {
if(!response ||response.code != 200){
this.$message.error(response && response.msg || "未知错误")
return;
}
this.emisStatList = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 查询明细列表 */
getDetailList() {
this.loading = true;
console.log("---->this.queryParams,", this.dateTimeRange);
if (null != this.dateTimeRange && '' != this.dateTimeRange) {
this.queryParams.params.beginScanDate = dateToStr(this.dateTimeRange[0]);
this.queryParams.params.endScanDate = dateToStr(this.dateTimeRange[1]);
}else{
this.queryParams.params.beginScanDate = null;
this.queryParams.params.endScanDate = null;
}
queryScanStatRecordList(this.queryParams).then(response => {
if(!response ||response.code != 200){
this.$message.error(response && response.msg || "未知错误")
return;
}
this.emisStatRecordList = response.rows;
this.recordTotal = response.total;
this.loading = false;
});
},
onStaffSelect(item){
this.queryParams.scanMan=item.empName || this.$store.getters.empName;
this.queryParams.scanManCode=item.empCode || this.$store.getters.empCode;
},
onScanSiteSelect(item){
this.queryParams.scanSite=item && item.siteName;
this.queryParams.scanSiteCode=item && item.siteCode;
},
onPreOrNextSiteSelect(item){
this.queryParams.preOrNextStation=item && item.siteName;
this.queryParams.preOrNextStationCode=item && item.siteCode;
},
onDestinationSelect(item){
this.queryParams.destCode=item && item.destCode;
this.queryParams.destName=item && item.destName;
},
onDateSelect(value){
console.log("date picker---->", value)
this.dateTimeRange=value;
// scanDate
},
// 表单重置
reset() {
this.form = {
id: null,
applySeq: null,
applyDate: getDateTimeToString(new Date()),
provideType: null,
applyName: null,
applyMan: null,
applyManCode: null,
applySite: null,
applySiteCode: null,
unitMoney: null,
applyCount: null,
sumMoney: null,
blSend: null,
sendDate: null,
sendMan: null,
sendManCode: null,
sendSite: null,
sendSiteCode: null,
blCancel: null,
cancelMan: null,
cancelManCode: null,
cancelDate: null,
cancelSite: null,
cancelSiteCode: null,
userSite: null,
userSiteCode: null,
startNo: null,
endNo: null,
curStartNo: null,
hasBillCount: null,
blAllowAllocate: null,
createSiteCode: null,
modifySiteCode: null,
delFlag: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
// handleQuery() {
// this.queryParams.pageNum = 1;
// this.getList();
// },
handleTypeSelect(selection){
this.sctype = selection.value;
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
debugger;
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
// 排序 查询字段是表格中字段名字 动态取值排序顺序
handleSortChange(column) {
this.queryParams.orderByColumn = column.prop;
this.queryParams.isAsc = column.order;
this.getList();
},
/** 新增按钮操作 */
handleAdd(row) {
this.reset();
this.open = true;
this.title = "新增";
// 子组件打开模式
// if(row != undefined){
// this.currentParentId = row.id
// }
// this.openEmisElectronicPagApply = true;
// this.titleEmisElectronicPagApply = "新增";
},
handleShowMoreInput(){
this.moreInputVisible = !this.moreInputVisible;
},
/** 修改按钮操作 */
handleUpdate() {
// this.reset();
// const id = this.ids
if(!this.ids || this.ids.length == 0){
this.$message.error("未选中数据,请先选择");
return;
}
this.open = true;
this.title = "修改";
// getEmisElectronicPagApply(id).then(response => {
// this.form = response.data;
// this.open = true;
// this.title = "修改";
// });
// 子组件打开模式
// this.currentId= row.id || this.ids;
// this.openEmisElectronicPagApply = true;
// this.titleEmisElectronicPagApply = "修改";
},
handleView(row) {
this.id=row.id;
this.titleView="查看";
this.openView=true;
// this.router.push({ path: '/emis/emisElectronicPagApply/viewDetail', query: { id: row.id }})
},
handleFormChanged(){
this.openForm = false;
this.getList();
},
/** 导出按钮操作 */
handleExport() {
// this.download('emis/emisElectronicPagApply/export', {
// ...this.queryParams
// }, `emisElectronicPagApply_${new Date().getTime()}.xlsx`)
const loadingInstance = this.$loading({
text: '正在导出...'
})
var qParam = {...this.queryParams};
qParam.pageNum=1;
qParam.pageSize=5000;
if (null != this.dateTimeRange && '' != this.dateTimeRange) {
this.queryParams.params["beginScanDate"] = this.dateTimeRange[0];
this.queryParams.params["endScanDate"] = this.dateTimeRange[1];
}
// this.queryParams.params["queryType"] = this.queryParams.queryType;//1:yd;2:dd;
// this.queryParams.params["isSubBill"] = this.queryParams.isSubBill;//1:子单;0:主单
listEmisTmsScanRecord(this.addDateRange(qParam, this.dateTimeRange)).then(response => {
this.downloadLoading = false
if (response.code === 200) {
const curList = []
for (let index = 0; index < response.rows.length; index++) {
let scanRstItem = response.rows[index];
let record =Object.assign({}, scanRstItem)
record.orderType = this.queryParams.orderType;
record.scanSiteName = this.queryParams.scanSiteName || record.scanSiteName;
record.preOrNextStation = this.queryParams.preOrNextStation || scanRstItem.preOrNextStation;
curList.push(record);
}
import('@/vendor/Export2Excel').then(excel => {
const tHeader = ['id','单号','单号类型','车牌号','扫描时间','扫描类型','扫描网点','上/下一网点','扫描员','录入时间','扫描重量'];
const filterVal = ['id','billCode','orderType','carNo','scanDate','scanType','scanSite','preOrNextStation','scanMan','createTime','scanWeight'];
const data = this.formatJson(filterVal, curList, curList)
excel.export_json_to_excel({
header: tHeader,
data,
filename: '网点电子面单申请',
autoWidth: true
})
loadingInstance.close()
})
}
});
// listEmisTmsScanRecord(this.addDateRange(qParam, this.dateTimeRange)).then(response => {
// this.emisStatList = [];
// this.loading = false;
// let rows = response.rows;
// this.total = response.total;
// if(!rows || rows.length == 0){
// this.$message.error("未查到单号");
// return;
// }
// for (let index = 0; index < rows.length; index++) {
// let scanRstItem = rows[index];
// console.log(scanRstItem);
// let record =Object.assign({}, scanRstItem)
// record.orderType = this.queryParams.orderType;
// record.scanSiteName = this.queryParams.scanSiteName || record.scanSiteName;
// record.preOrNextStation = this.queryParams.preOrNextStation || scanRstItem.preOrNextStation;
// this.emisStatList.push(record);
// }
// });
},
formatJson(filterVal, jsonData, resData) {
let index = 0
return jsonData.map(v => filterVal.map(j => {
if (j === 'index') {
return ++index
}
if (j === 'status') {
var statusStr='xxx'
if(v[j] == 10){
statusStr='xxx'
}
return statusStr;
}
return v[j]
}))
},
/** 列索引函数 */
// getIndex($index) {
// return (this.queryParams.pageNum - 1) * this.queryParams.pageSize + $index + 1
// },
/** 时间搜索响应函数 */
// dateTimeChange(value){
// this.dateTimeRange=value;
// },
handleQuery(){
// this.queryParams.pageNum = 1;
// if(this.queryParams.billCode==null || this.queryParams.billCode==''){
// this.$message.error("请输入单号");
// return;
// }
// if(this.dataMap[this.queryParams.billCode]){
// this.$message.error("重复扫描");
// this.playNoticeTone(1);
// return;
// }
let queryType = this.queryParams.queryType;
if(queryType == "1"){
this.queryParams.orderSN=null;
}else if(queryType == "2"){
this.queryParams.orderSN=this.queryParams.billCode;
this.queryParams.billCode=null;
}
let beginSignDate=null;
let endSignDate=null;
if (null != this.dateTimeRange && '' != this.dateTimeRange) {
beginSignDate = this.dateTimeRange[0];
endSignDate = this.dateTimeRange[1];
}
// 检查
let scanInfo = {
scanType:"50",
opType:1,
scanData:[
{
billCode:this.queryParams.billCode,
orderSN:this.queryParams.orderSN,
beginSignDate:beginSignDate,
endSignDate:endSignDate,
scanSiteCode:this.queryParams.scanSiteCode,
isSignPic:this.queryParams.isSignPic,
dispatchOrSendManCode:this.queryParams.dispatchOrSendManCode,
countryCode:this.queryParams.countryCode
// scanWeight:this.form.scanWeight,
// dispatchOrSendManCode:this.form.dispatchOrSendManCode
}
]
};listEmisTmsScanRecord
doScan(scanInfo).then(response => {
console.log(response);
let scanRstItem = response.data.scanResult[0];
console.log(scanRstItem);
if(scanRstItem.result != 'success'){
this.$modal.msgError(scanRstItem.message);
return;
}
this.form.scanType = '50';
this.form.scanDate = new Date();
let record =Object.assign({}, this.form)
record.billCode=scanRstItem.billCode;
console.log(record)
let indexBillCode=record.billCode;
this.dataMap[indexBillCode]=record;
this.emisStatList.push(record);
});
this.form.billCode =null;
},
}
};
</script>
<style scoped>
.el-divider{
margin-top: 0px;
background: 0 0;
border-top: 1px solid #E6EBF5;
}
.el-divider__text {
color: #0955ee;
cursor: pointer;
}
.ellipsis {
overflow: hidden;
text-overflow: ellipsis;
vertical-align: top;
white-space: nowrap;
}
</style>