emis-frontend/src/views/emis/emisTmsScanRecord/HasSendNoArriveQuery.vue

660 lines
21 KiB
Vue
Raw Normal View History

2024-10-08 10:22:28 +00:00
<template>
<XdPageContainer class="app-container">
<SearchForm slot="pageHeader" :model="queryParams" ref="queryForm"
size="mini" :maxShow="8"
v-show="showSearch"
@search="handleQuery"
@reset="resetQuery"
:isShowSearchBtn="false"
>
<el-row :gutter="0" style="display: flex;flex-wrap: wrap;">
<el-col :span="6">
<el-form-item label="扫描时间" prop="dateTimeRange">
<elDateAdvPicker clearable v-model="dateTimeRange" @dateTimeChange="onDateSelect" ></elDateAdvPicker>
</el-form-item>
</el-col>
<el-col :span="18">
<el-form-item :label="$t('扫描网点')" prop="scanSiteCode" label-width="100px">
<EmisSiteSimplePicker v-model="queryParams.scanSiteCode" @onChange="onScanSiteSelect" ></EmisSiteSimplePicker>
</el-form-item>
<el-form-item :label="$t('下一网点')" prop="preOrNextStation" label-width="100px">
<EmisSiteSimplePicker v-model="queryParams.preOrNextStation" @onChange="onPreOrNextSiteSelect" ></EmisSiteSimplePicker>
</el-form-item>
<el-form-item :label="$t('目的网点')" prop="destSiteCode" label-width="100px">
<EmisSiteSimplePicker v-model="queryParams.destSiteCode" @onChange="onPreOrNextSiteSelect" ></EmisSiteSimplePicker>
</el-form-item>
<el-form-item label="线路" prop="transLineType">
<TransLinePicker v-model="queryParams.transLineType" isInitiated="true" ></TransLinePicker>
</el-form-item>
<el-form-item label="产品类型" prop="productType">
<TransProductPicker placeholder="产品类型" v-model="queryParams.productType" :transLineCode="queryParams.transLineType" ></TransProductPicker>
</el-form-item>
</el-col>
</el-row>
</SearchForm>
<xd-table
slot="pageContent"
slot-scope="slotProps"
:height="(slotProps.contentHeight)+'px'"
v-loading="loading"
ref="dataTable"
border
size="mini"
storageName="HasSendNoArriveQuery_main"
:data="scanRecordDataList"
:showSearch.sync="showSearch"
:queryParams="queryParams"
:total="total"
@queryTable="getList"
@selection-change="handleSelectionChange"
@sort-change="handleSortChange"
>
<div slot="toolbar">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
size="mini"
@click="handleQuery"
>查询</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
size="mini"
@click="handleExport"
>导出</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="billCode" min-width="170"/>
<el-table-column :label="$t('单号类型')" align="center" prop="scanBillType" min-width="80">
<template slot-scope="scope">
<el-tag type="error" v-if="scope.row.billCode!=scope.row.mainBillCode">子单</el-tag>
<el-tag type="success" v-else>主单</el-tag>
</template>
</el-table-column>
<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="scanSite" min-width="150" />
<el-table-column :label="$t('下一网点')" align="center" prop="preOrNextStation" min-width="100" />
<el-table-column :label="$t('扫描员')" align="center" prop="scanMan" min-width="150" />
<el-table-column :label="$t('录入时间')" align="center" prop="createTime" min-width="170" >
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('扫描重量')" align="center" prop="scanWeight" min-width="100" />
<el-table-column :label="$t('车牌号')" align="center" prop="carNo" min-width="100" />
</xd-table>
<!-- 添加或修改网点电子面单申请对话框 -->
<el-dialog :title="title" :visible.sync="open" width="50%" v-dialogDrag :close-on-click-modal="false" append-to-body>
<el-row :gutter="0">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-col :span="8">
<el-form-item :label="$t('扫描网点')" prop="scanSiteCode" label-width="70px">
<EmisSiteSimplePicker key="2" v-model="modifyParams.scanSiteCode" @onChange="onModifyScanSiteSelect" ></EmisSiteSimplePicker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('上/下一网点')" prop="preOrNextStationCode" label-width="90px">
<EmisSiteSimplePicker key="3" v-model="modifyParams.preOrNextStationCode" @onChange="onModifyPreOrNextSiteSelect" ></EmisSiteSimplePicker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('扫描员工')" prop="scanManCode">
<EmisUserSimplePicker key="4" v-model="modifyParams.scanManCode" postCode="RSD" @onChange="onModifyStaffSelect" ></EmisUserSimplePicker>
</el-form-item>
</el-col>
</el-form>
</el-row>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</XdPageContainer>
</template>
<script>
import { listEmisElectronicPagApply, getEmisElectronicPagApply, delEmisElectronicPagApply, addEmisElectronicPagApply, updateEmisElectronicPagApply } from "@/api/emis/emisElectronicPagApply";
import { listEmisTmsScanRecord, delEmisTmsScanRecord, updateEmisTmsScanRecord } 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 DestinationPicker from '@/views/emis/EmisBaseTools/DestinationPicker.vue';
// import elDateSimplePicker from '@/components/DatePickerAdv/elDateSimplePicker';
import EmisUserSimplePicker from '@/views/emis/EmisBaseTools/EmisUserSimplePicker.vue';
import TransLinePicker from '@/views/emis/EmisBaseTools/TransLinePicker.vue';
import TransProductPicker from '@/views/emis/EmisBaseTools/TransProductPicker.vue';
import { getDateTimeToString } from '@/utils/payutils'
import { parseTime, dateToStr,formatQueryString } from "@/utils/custom";
import {timeDiffTime,timeFormat} from '@/utils/dateUtils'
export default {
name: "HasSendNoArriveQuery",
components: { EmisUserSimplePicker,elDateAdvPicker,
EmisSiteSimplePicker,
EmisGetNextSitePicker,
DestinationPicker,
TransLinePicker,
TransProductPicker },
dicts: ['emis_scan_type'],
data() {
return {
// 调整表格的高度,不允许滚动
tableHeight: 200,
// 遮罩层
loading: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 创建时间搜索
dateTimeRange:[],
// 总条数
total: 0,
// 网点电子面单申请表格数据
scanRecordDataList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
openForm: false,
titleForm: "",
titleEmisElectronicPagApply: "",
openEmisElectronicPagApply: false,
// 显示编辑框更多
moreInputVisible: false,
// 弹出展示层
currentId:null,
id:null,
titleView:"",
openView: false,
// 备注时间范围
daterangeApplyDate: [],
// 备注时间范围
daterangeCreateTime: [],
// 备注时间范围
daterangeUpdateTime: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 100,
orderSN:null,
billCode: null,
scanType: null,
scanDate: null,
scanManCode: null,
scanManPhone: null,
scanMan: null,
scanSite: null,
scanSiteCode: null,
scanSitePhone: null,
scanWeight: null,
weight: null,
dispatchOrSendMan: null,
dispatchOrSendManCode: null,
dispatchOrSendManPhone: null,
signDate: null,
signMan: null,
signSite: null,
signSiteCode: null,
recordMan: null,
recordManCode: null,
recordManPhone: null,
recordSiteCode: null,
truckMan: null,
truckCode: null,
dataFrom: null,
picUrl: null,
status: null,
delFlag: null,
remark: null,
params:{
scanQueryType:1,
},//扩展参数
// scanSite:null,
queryType:"1",// 选择运单类型,默认为 运单号:1,订单号:0
// scanType:"",
isSubBill:"",
},
// 修改参数
modifyParams:{
scanSite:null,
scanSiteCode:null,
scanSitePhone:null,
preOrNextStation:null,
preOrNextStationCode:null,
preOrNextStationPhone:null,
scanMan:null,
scanManCode:null,
scanManPhone:null,
},
// 表单参数
form: {},
// 表单校验
rules: {
id: [
{ required: true, message: "id不能为空", trigger: "blur" }
],
}
};
},
created() {
const end = new Date()
const start = new Date()
start.setHours(0,0,0,0)
end.setHours(23,59,59,0)
this.dateTimeRange=[timeFormat(start), timeFormat(end)]
},
mounted() {
},
methods: {
initQueryParams(){
this.queryParams=this.addDateRange(this.queryParams, this.dateTimeRange,"scanDate");
let qParam=null;
if(this.queryParams.billCode){
qParam={
pageNum:this.queryParams.pageNum,
pageSize:this.queryParams.pageSize,
billCode:this.queryParams.billCode,
}
}else{
qParam=this.queryParams
}
return qParam;
},
/** 查询扫描记录列表 */
getList() {
this.loading = true;
let qParam=this.initQueryParams();
listEmisTmsScanRecord(qParam).then(response => {
this.loading = false;
this.scanRecordDataList= response.rows;
this.total = response.total;
});
},
// 取消按钮
cancel() {
this.open = false;
this.resetModifyParams();
},
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){
this.dateTimeRange=value;
},
onModifyScanSiteSelect(item){
this.modifyParams.scanSite=item.siteName;
this.modifyParams.scanSiteCode = item.siteCode
this.modifyParams.scanSitePhone = item.scanSitePhone;
},
onModifyPreOrNextSiteSelect(item){
this.modifyParams.preOrNextStation=item.siteName;
this.modifyParams.preOrNextStationCode=item.siteCode;
this.modifyParams.preOrNextStationPhone=item.preOrNextStationPhone;
},
onModifyStaffSelect(item){
this.modifyParams.scanMan=item.empName;
this.modifyParams.scanManCode=item.empCode;
// this.modifyParams.scanManPhone=item.scanManPhone;
},
//删除
clearSelectionBatch(){
let newList =[];
console.log(this.ids)
this.scanRecordDataList.forEach(item=>{
if(this.ids.indexOf(item.id) == -1){
newList.push(item);
}
});
this.scanRecordDataList = newList;
},
// 表单重置
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();
},
// handleClearCode(){
// this.queryParams.billCode=null;
// },
handleTypeSelect(selection){
this.sctype = selection.value;
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
resetModifyParams(){
this.modifyParams = {
scanSite:null,
scanSiteCode:null,
scanSitePhone:null,
preOrNextStation:null,
preOrNextStationCode:null,
preOrNextStationPhone:null,
scanMan:null,
scanManCode:null,
scanManPhone:null,
}
},
// 多选框选中数据
handleSelectionChange(selection) {
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.$modal.msgError("未选中数据,请先选择");
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 }})
},
/** 提交按钮 */
submitForm() {
for(var i=0; i<this.ids.length;i++){
updateEmisTmsScanRecord({
id:this.ids[i],
...this.modifyParams
}).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.resetModifyParams();
this.getList();
});
}
// this.$refs["form"].validate(valid => {
// if (valid) {
// if (this.form.id != null) {
// updateEmisElectronicPagApply(this.form).then(response => {
// this.$modal.msgSuccess("修改成功");
// this.open = false;
// this.getList();
// });
// } else {
// addEmisElectronicPagApply(this.form).then(response => {
// this.$modal.msgSuccess("新增成功");
// this.open = false;
// this.getList();
// });
// }
// }
// });
// todo
},
handleFormChanged(){
this.openForm = false;
this.getList();
},
cancelForm(){
this.openForm = false;
},
/** 删除按钮操作 */
handleDelete() {
const ids = this.ids
this.$modal.confirm('是否确认删除').then(function() {
return delEmisTmsScanRecord(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
let that = this;
const loadingInstance = this.$loading({
text: '正在导出...'
})
var qParam = {...this.queryParams};
qParam.pageNum=1;
qParam.pageSize=500;
if (null != this.dateTimeRange && '' != this.dateTimeRange) {
qParam.params.beginScanDate = dateToStr(new Date(this.dateTimeRange[0]));
qParam.params.endScanDate = dateToStr(new Date(this.dateTimeRange[1]));
}else{
qParam.params.beginScanDate = null;
qParam.params.endScanDate = null;
}
qParam.params.queryType = this.queryParams.queryType;//1:yd;2:dd;
qParam.params.isSubBill = this.queryParams.isSubBill;//1:子单;0:主单
let queryType = this.queryParams.queryType;
if(queryType == "1"){
qParam.orderSN=null;
}else if(queryType == "0"){
qParam.orderSN=this.queryParams.billCode;
qParam.billCode=null;
}
listEmisTmsScanRecord(qParam).then(response => {
this.loadingInstance = 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)
if(this.queryParams.queryType!="1"){
record.billCode = qParam.orderSN;
}
record.scanSiteName = this.queryParams.scanSiteName || record.scanSiteName;
record.preOrNextStation = this.queryParams.preOrNextStation || scanRstItem.preOrNextStation;
record.scanDate = parseTime(record.scanDate);
record.createTime = parseTime(record.createTime);
console.log(that)
record.scanType = that.dict.label.emis_scan_type[record.scanType];
curList.push(record);
}
let tHeader = [];// ['id','单号','单号类型','车牌号','扫描时间','扫描类型','扫描网点','上/下一网点','扫描员','录入时间','扫描重量'];
let filterVal = [];// ['id','billCode','orderType','carNo','scanDate','scanType','scanSite','preOrNextStation','scanMan','createTime','scanWeight'];
for(let sl = 0; sl < this.$refs.dataTable.storageList.length; sl++){
if(this.$refs.dataTable.storageList[sl].show){
tHeader.push(this.$refs.dataTable.storageList[sl].label);
filterVal.push(this.$refs.dataTable.storageList[sl].prop);
}
}
import('@/vendor/Export2Excel').then(excel => {
const data = this.formatJson(filterVal, curList, curList)
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 === '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;
// },
}
};
</script>
<style lang="scss" 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;
}
}
</style>