问题件录入,新增逻辑完善

This commit is contained in:
liuyp 2024-06-05 20:31:20 +08:00
parent 26f9110fcb
commit 0e04da384b

View File

@ -5,9 +5,9 @@
<el-col :span="8"> <el-col :span="8">
<el-form-item label="扫描单号" prop="billCode" label-width="80px"> <el-form-item label="扫描单号" prop="billCode" label-width="80px">
<span slot="label"> <span slot="label">
<span style="color: red">扫描单号</span> <span style="color: red">{{$t('扫描单号')}}</span>
</span> </span>
<el-input v-model="form.billCode" clearable="" placeholder="单号输入后按回车" @keyup.enter.native="handleScanInput" > <el-input v-model="form.billCode" clearable="" placeholder="单号输入后按回车" @keyup.enter.native="handleScanInput" >
<i slot="suffix" class="iconfont">&#xe656;</i> <i slot="suffix" class="iconfont">&#xe656;</i>
</el-input> </el-input>
</el-form-item> </el-form-item>
@ -16,16 +16,25 @@
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item :label="$t('通知网点')" prop="notifySite" label-width="80px"> <el-form-item :label="$t('通知网点')" prop="notifySite" label-width="80px">
<EmisSiteSimplePicker v-model="form.notifySite" @onChange="onScanSiteSelect" ></EmisSiteSimplePicker> <!-- <EmisSiteSimplePicker v-model="form.notifySite" @onChange="onScanSiteSelect" ></EmisSiteSimplePicker> -->
<el-select v-model="form.notifySiteCode" @change="onScanSiteSelect">
<el-option v-for="item in notifySiteDataSource" :key="item.notifySiteCode" :value="item.notifySiteCode" :label="item.notifySiteName" ></el-option>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item :label="$t('问题类型')" prop="problemType" label-width="80px"> <el-form-item :label="$t('问题类型')" prop="problemType" label-width="80px">
<span slot="label">
<span style="color: red">{{$t('问题类型')}}</span>
</span>
<ProblemTypePicker v-model="form.problemId" @onChange="onproblemTypeSelect" ></ProblemTypePicker> <ProblemTypePicker v-model="form.problemId" @onChange="onproblemTypeSelect" ></ProblemTypePicker>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="问题原因" prop="remark" label-width="80px"> <el-form-item label="问题原因" prop="remark" label-width="80px">
<span slot="label">
<span style="color: red">{{$t('问题原因')}}</span>
</span>
<el-input <el-input
v-model="form.remark" v-model="form.remark"
:placeholder="$t('请输入')" :placeholder="$t('请输入')"
@ -38,23 +47,10 @@
<ImageUpload v-model="form.picUrl" @input="handleInput" :isShowTip="false" ></ImageUpload> <ImageUpload v-model="form.picUrl" @input="handleInput" :isShowTip="false" ></ImageUpload>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8">
<el-button
type="primary"
plain
icon=""
size="mini"
@click="handleScanInput"
>登记</el-button>
</el-col>
</el-row> </el-row>
</el-form> </el-form>
<div> <div>
</div> </div>
<xd-table v-loading="loading" <xd-table v-loading="loading"
border stripe border stripe
size="small" size="small"
@ -66,6 +62,15 @@
> >
<div slot="toolbar"> <div slot="toolbar">
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon=""
size="mini"
@click="handleRegister"
>登记</el-button>
</el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="primary" type="primary"
@ -124,28 +129,31 @@
</el-row> </el-row>
</div> </div>
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column :label="$t('运单号')" align="center" prop="billCode" min-width="100" /> <el-table-column :label="$t('运单号')" align="center" prop="billCode" min-width="170" />
<el-table-column :label="$t('通知网点')" align="center" prop="notifySiteName" min-width="100" /> <el-table-column :label="$t('状态')" align="center" prop="currentStatus" min-width="100" />
<el-table-column :label="$t('登记网点')" align="center" prop="scanSite" min-width="100" /> <el-table-column :label="$t('通知网点')" align="center" prop="notifySiteName" min-width="170" />
<el-table-column :label="$t('登记日期')" align="center" prop="scanDate" min-width="100"> <el-table-column :label="$t('登记网点')" align="center" prop="scanSite" min-width="170" />
<el-table-column :label="$t('登记日期')" align="center" prop="scanDate" min-width="170">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.scanDate) }}</span> <span>{{ parseTime(scope.row.scanDate) }}</span>
</template> </template>
</el-table-column>
</el-table-column> </el-table-column>
<el-table-column :label="$t('问题件类型')" align="center" prop="problemTypeName" min-width="150" /> <el-table-column :label="$t('问题件类型')" align="center" prop="problemTypeName" min-width="100" />
<el-table-column :label="$t('登记人')" align="center" prop="scanMan" min-width="100" /> <el-table-column :label="$t('登记人')" align="center" prop="scanMan" min-width="150" />
<el-table-column :label="$t('图片路径')" align="center" prop="picUrl" min-width="100"> <el-table-column :label="$t('图片路径')" align="center" prop="picUrl" min-width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<span class="ellipsis">{{scope.row.picUrl}}</span> <span class="ellipsis">{{scope.row.picUrl}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('问题件原因')" align="center" prop="remark" min-width="100" /> <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="dataFrom" min-width="100" /> <el-table-column :label="$t('数据来源')" align="center" prop="dataFrom" min-width="100" />
<el-table-column :label="$t('所属业务员')" align="center" prop="marketMan" min-width="100" /> <el-table-column :label="$t('所属业务员')" align="center" prop="marketMan" min-width="170" />
<el-table-column :label="$t('业务员编号')" align="center" prop="marketManCode" min-width="100" /> <el-table-column :label="$t('业务员编号')" align="center" prop="marketManCode" min-width="100" />
</xd-table> </xd-table>
<!-- 添加或修改问题件对话框 --> <!-- 添加或修改问题件对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag :close-on-click-modal="false" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag :close-on-click-modal="false" append-to-body>
<el-row :gutter="0"> <el-row :gutter="0">
@ -156,7 +164,6 @@
<EmisSiteSimplePicker v-model="form.modifyNotifySite" @onChange="onModifyScanSiteSelect" ></EmisSiteSimplePicker> <EmisSiteSimplePicker v-model="form.modifyNotifySite" @onChange="onModifyScanSiteSelect" ></EmisSiteSimplePicker>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-form> </el-form>
</el-row> </el-row>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@ -164,7 +171,6 @@
<el-button @click="cancel">取 消</el-button> <el-button @click="cancel">取 消</el-button>
</div> </div>
</el-dialog> </el-dialog>
<el-dialog :title="titleBatch" :visible.sync="openBatch" width="50%" v-dialogDrag :close-on-click-modal="false" append-to-body> <el-dialog :title="titleBatch" :visible.sync="openBatch" width="50%" v-dialogDrag :close-on-click-modal="false" append-to-body>
<el-form ref="formBatch" :model="formBatch" size="mini" label-width="60px"> <el-form ref="formBatch" :model="formBatch" size="mini" label-width="60px">
<el-row> <el-row>
@ -188,7 +194,6 @@ import { addEmisWaybillProblemInfo,listEmisWaybillProblemInfo } from "@/api/emis
import { doScan } from "@/api/emis/emisTmsScanRecord"; import { doScan } from "@/api/emis/emisTmsScanRecord";
import { listEmisWaybill } from "@/api/emis/emisWaybill"; import { listEmisWaybill } from "@/api/emis/emisWaybill";
// import { getWaybillDetail } from "@/api/emis/emisWaybill"; // import { getWaybillDetail } from "@/api/emis/emisWaybill";
import EmisSiteSimplePicker from '@/views/emis/EmisBaseTools/EmisSiteSimplePicker.vue'; import EmisSiteSimplePicker from '@/views/emis/EmisBaseTools/EmisSiteSimplePicker.vue';
import ProblemTypePicker from '@/views/emis/EmisBaseTools/ProblemTypePicker.vue'; import ProblemTypePicker from '@/views/emis/EmisBaseTools/ProblemTypePicker.vue';
@ -215,6 +220,8 @@ export default {
// 问题件表格数据 // 问题件表格数据
emisWaybillList: [], emisWaybillList: [],
notifySiteDataSource:[],
title: "", title: "",
open: false, open: false,
titleBatch:"", titleBatch:"",
@ -224,10 +231,9 @@ export default {
problemType:null, problemType:null,
openForm: false, openForm: false,
titleForm: "", titleForm: "",
tempRecord:{},
titleEmisWaybillProblemInfo: "", titleEmisWaybillProblemInfo: "",
openEmisWaybillProblemInfo: false, openEmisWaybillProblemInfo: false,
// 显示编辑框更多 // 显示编辑框更多
moreInputVisible: false, moreInputVisible: false,
@ -284,12 +290,17 @@ export default {
}, },
onScanSiteSelect(item){ onScanSiteSelect(item){
if(!item){ if(!item){
this.form.modifyNotifySite = null; this.form.notifySiteCode = null;
this.form.modifyNotifySiteName = null; this.form.notifySiteName = null;
return; return;
} }
this.form.notifySite=item && item.siteCode; // this.form.notifySiteCode=item.notifySiteCode;
this.form.notifySiteName=item && item.siteName; this.notifySiteDataSource.forEach(nItem => {
if(nItem.notifySiteCode == item){
this.form.notifySiteName=nItem.notifySiteName;
return;
}
})
}, },
onproblemTypeSelect(item){ onproblemTypeSelect(item){
// debugger; // debugger;
@ -314,15 +325,18 @@ export default {
this.form.modifyNotifySiteName=item && item.siteName; this.form.modifyNotifySiteName=item && item.siteName;
}, },
handleBatchRegister(){ handleBatchRegister(){
if(this.form.notifySite==null || this.form.notifySite==''){ // if(this.form.notifySite==null || this.form.notifySite==''){
this.$message.error("请选择通知网点"); // this.$message.error("请选择通知网点");
return; // return;
} // }
if(this.form.problemType==null || this.form.problemType==''){ if(this.form.problemType==null || this.form.problemType==''){
this.$message.error("请选择问题类型"); this.$message.error("请选择问题类型");
return; return;
} }
if(this.form.remark==null || this.form.remark==''){
this.$message.error("请填写问题原因");
return;
}
this.formBatch = { this.formBatch = {
billCode: null, billCode: null,
} }
@ -342,26 +356,9 @@ export default {
this.$message.error("输入单号后回车"); this.$message.error("输入单号后回车");
return; return;
} }
// if(this.form.notifySite==null || this.form.notifySite==''){ // this.getWaybill(this.form.billCode)
// this.$message.error("请选择通知网点");
// return;
// }
// if(this.form.problemType==null || this.form.problemType==''){
// this.$message.error("请选择问题类型");
// return;
// }
// if(this.dataMap[this.form.billCode]){
// this.$message.error("重复登记");
// this.playNoticeTone(1);
// return;
// }
this.getWaybill(this.form.billCode)
},
getWaybill(billCode){
this.loading = true; this.loading = true;
listEmisWaybill({billCode:billCode}).then(response => { listEmisWaybill({billCode:this.form.billCode}).then(response => {
this.loading = false; this.loading = false;
let scanDate = new Date(); let scanDate = new Date();
if(response.code != 200){ if(response.code != 200){
@ -371,73 +368,150 @@ export default {
let rows = response.rows; let rows = response.rows;
if(!rows || rows.length == 0){ if(!rows || rows.length == 0){
this.$message.error("未查到单号"); this.$message.error("未查到单号");
this.form.billCode=null;
return; return;
} }
for (let index = 0; index < rows.length; index++) { if(rows.length>0) {
let rsItem = rows[index]; let rsItem = rows[0];
console.log(rsItem); console.log(rsItem);
let record =Object.assign({}, rsItem) this.tempRecord =Object.assign({}, rsItem)
record.notifySite = this.form.notifySite; // tempRecord.notifySite = tempRecord.sendSiteCode;
record.notifySiteName = this.form.notifySiteName; // tempRecord.notifySiteName = tempRecord.sendSiteName;
record.scanSiteCode=this.form.scanSiteCode; this.tempRecord.scanSiteCode=this.form.scanSiteCode;
record.scanSite=this.form.scanSite; this.tempRecord.scanSite=this.form.scanSite;
record.scanDate=scanDate; this.tempRecord.scanDate=scanDate;
record.problemType=this.form.problemType; this.tempRecord.scanMan=this.form.scanMan;
record.scanMan=this.form.scanMan; this.tempRecord.scanManCode=this.form.scanManCode;
record.scanManCode=this.form.scanManCode; this.tempRecord.dataFrom="PC";
record.picUrl=this.form.picUrl; this.notifySiteDataSource=[
record.remark=this.form.remark; {
record.dataFrom="PC"; notifySiteCode:this.tempRecord.sendSiteCode,
this.emisWaybillList.push(record); notifySiteName:this.tempRecord.sendSiteName,
this.dataMap[this.form.billCode]=record; },
{
notifySiteCode:this.tempRecord.dispatchUnderlingSiteCode,
notifySiteName:this.tempRecord.dispatchUnderlingSiteName,
}
]
// this.billInputDisabled = true;
// this.emisWaybillList.push(tempRecord);
// this.dataMap[this.form.billCode]=tempRecord;
} }
this.form.billCode=null; // this.form.billCode=null;
}) })
}, },
handleRegister(){
if(this.form.notifySiteCode==null || this.form.notifySiteCode==''){
this.$message.error("请选择通知网点");
return;
}
if(this.form.problemType==null || this.form.problemType==''){
this.$message.error("请选择问题类型");
return;
}
if(this.form.remark==null || this.form.remark==''){
this.$message.error("请填写问题原因");
return;
}
this.tempRecord.notifySiteCode = this.form.notifySiteCode;
this.tempRecord.notifySiteName = this.form.notifySiteName;
this.tempRecord.problemTypeName=this.form.problemType;
this.tempRecord.problemType = this.form.problemType;
this.tempRecord.problemId = this.form.problemId;
this.tempRecord.remark = this.form.remark;
this.tempRecord.picUrl=this.form.picUrl;
this.emisWaybillList.push(this.tempRecord);
this.dataMap[this.form.billCode]=this.tempRecord;
//清理数据
this.form.notifySiteCode="";
this.form.notifySiteName="";
this.tempRecord=null;
this.form.billCode=null;
this.notifySiteDataSource=[];
console.log(this.emisWaybillList)
},
// getWaybill(billCode){
// this.loading = true;
// listEmisWaybill({billCode:billCode}).then(response => {
// this.loading = false;
// let scanDate = new Date();
// if(response.code != 200){
// this.$message.error(response.msg);
// return;
// }
// let rows = response.rows;
// if(!rows || rows.length == 0){
// this.$message.error("未查到单号");
// return;
// }
// for (let index = 0; index < rows.length; index++) {
// let rsItem = rows[index];
// console.log(rsItem);
// let record =Object.assign({}, rsItem)
// record.notifySiteCode = recs;
// record.notifySiteName = record.sendSiteName;
// record.scanSiteCode=this.form.scanSiteCode;
// record.scanSite=this.form.scanSite;
// record.scanDate=scanDate;
// record.problemType=this.form.problemType;
// record.problemId=this.form.problemId;
// record.scanMan=this.form.scanMan;
// record.scanManCode=this.form.scanManCode;
// record.picUrl=this.form.picUrl;
// record.remark=this.form.remark;
// record.dataFrom="PC";
// this.emisWaybillList.push(record);
// this.dataMap[this.form.billCode]=record;
// }
// this.form.billCode=null;
// })
// },
handleUpload(){ handleUpload(){
let scanData=[]; let scanData=[];
let problemInfoList=[]; // let problemInfoList=[];
this.emisWaybillList.forEach(item=>{ this.emisWaybillList.forEach(item=>{
// item.currentStatus="已上传";
if(this.ids.indexOf(item.id) > -1){ if(this.ids.indexOf(item.id) > -1){
scanData.push( scanData.push(
{ {
billCode:item.billCode, billCode:item.billCode,
problemType:item.problemType, problemType:item.problemId,
notifySite:item.notifySite, notifySite:item.notifySiteCode,
picUrl:item.picUrl, picUrl:item.picUrl,
remark:item.remark, remark:item.remark,
scanWeight:item.scanWeight, scanWeight:item.scanWeight,
scanDate:item.scanDate scanDate:item.scanDate
} }
) )
problemInfoList.push({ // problemInfoList.push({
billCode: item.billCode, // billCode: item.billCode,
problemType: item.problemType, // problemType: item.problemType,
problemTitle: null, // problemTitle: null,
problemCause: item.remark, // problemCause: item.remark,
sendSite: item.sendSiteName, // sendSite: item.sendSiteName,
sendSiteCode: item.sendSiteCode, // sendSiteCode: item.sendSiteCode,
registerManCode: item.registerManCode, // registerManCode: item.registerManCode,
registerManDept: null, // registerManDept: null,
registerSiteCode: item.registerSiteCode, // registerSiteCode: item.registerSiteCode,
registerDate: item.registerDate, // registerDate: item.registerDate,
registerSaveDate: null, // registerSaveDate: null,
dataFrom: item.dataFrom, // dataFrom: item.dataFrom,
status: null,//item.waybillStatus,//????????是否正确 // status: null,//item.waybillStatus,//????????是否正确
isSendSiteRegister: null, // isSendSiteRegister: null,
// blReversion: false,//????????是否正确 // // blReversion: false,//????????是否正确
blReversion: null, // blReversion: null,
reversionStr: null, // reversionStr: null,
reversionMan: null, // reversionMan: null,
reversionManCode: null, // reversionManCode: null,
reversionDate: null, // reversionDate: null,
blCheckok: null, // blCheckok: null,
blSee: null, // blSee: null,
filePath: item.picUrl, // filePath: item.picUrl,
modifySiteCode: null, // modifySiteCode: null,
delFlag: item.delFlag,//????????是否正确 // delFlag: item.delFlag,//????????是否正确
remark: item.remark,//????????是否正确 // remark: item.remark,//????????是否正确
}) // })
} }
}); });
@ -447,6 +521,8 @@ export default {
scanData:scanData scanData:scanData
}; };
let newList = [];
doScan(scanProblemInfo).then(response => { doScan(scanProblemInfo).then(response => {
let scanRstItem = response.data.scanResult[0]; let scanRstItem = response.data.scanResult[0];
console.log(scanRstItem); console.log(scanRstItem);
@ -454,28 +530,33 @@ export default {
this.$modal.msgError(scanRstItem.message); this.$modal.msgError(scanRstItem.message);
return; return;
} }
this.emisWaybillList.forEach(item=>{
if(this.ids.indexOf(item.id) > -1){
item.currentStatus="已上传";
}
newList.push(item);
})
this.emisWaybillList = newList;
this.$modal.msgSuccess(scanRstItem.message); this.$modal.msgSuccess(scanRstItem.message);
}); });
problemInfoList.forEach(item => { // problemInfoList.forEach(item => {
addEmisWaybillProblemInfo(item).then(response => { // addEmisWaybillProblemInfo(item).then(response => {
// debugger; // // debugger;
if(response.code != "200"){ // if(response.code != "200"){
this.$modal.msgError(response.msg); // this.$modal.msgError(response.msg);
return; // return;
} // }
this.$modal.msgSuccess(response.msg); // this.$modal.msgSuccess(response.msg);
}) // })
}) // })
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
let newList = []; let newList = [];
debugger
for(let i = 0; i< this.emisWaybillList.length;i++){ for(let i = 0; i< this.emisWaybillList.length;i++){
let waybill = {...this.emisWaybillList[i]}; let waybill = {...this.emisWaybillList[i]};
if(this.ids.indexOf(waybill.id) > -1){ if(this.ids.indexOf(waybill.id) > -1){
waybill.notifySite=this.form.modifyNotifySite; waybill.notifySiteCode=this.form.modifyNotifySite;
waybill.notifySiteName=this.form.modifyNotifySiteName; waybill.notifySiteName=this.form.modifyNotifySiteName;
newList.push(waybill); newList.push(waybill);
}else{ }else{
@ -485,22 +566,58 @@ export default {
this.emisWaybillList = newList; this.emisWaybillList = newList;
this.open = false; this.open = false;
}, },
submitFormBatch(){ async submitFormBatch(){
if(this.formBatch.billCode==null || this.formBatch.billCode==''){ if(this.formBatch.billCode==null || this.formBatch.billCode==''){
this.$message.error("输入单号后回车"); this.$message.error("输入单号后回车");
return; return;
} }
let bcList=this.formBatch.billCode.split(/[;\;\,\,\n]/)||[]; let bcList=this.formBatch.billCode.split(/[;\;\,\,\n]/)||[];
bcList.forEach(code => { // bcList.forEach(code => {
// if(this.dataMap[code]){ // this.getWaybill(code)
// this.$message.error("重复登记:"+code); // });
// this.playNoticeTone(1); this.loading = true;
// return; for(let bc=0;bc<bcList.length;bc++){
// } await this.addToList(bcList[bc]);
this.getWaybill(code) }
}); this.loading = false;
this.openBatch=false; this.openBatch=false;
}, },
async addToList(billCode){
let response = await listEmisWaybill({billCode:billCode})
if(!response || response.code != 200){
this.$message.error(response && response.msg || '未知错误');
}
let scanDate = new Date();
if(response.code != 200){
this.$message.error(response.msg);
return;
}
let rows = response.rows;
if(!rows || rows.length == 0){
this.$message.error("未查到单号: " + billCode);
return;
}
for (let index = 0; index < rows.length; index++) {
let rsItem = rows[index];
console.log(rsItem);
let record =Object.assign({}, rsItem)
record.notifySiteCode = record.sendSiteCode;
record.notifySiteName = record.sendSiteName;
record.scanSiteCode=this.form.scanSiteCode;
record.scanSite=this.form.scanSite;
record.scanDate=scanDate;
record.problemTypeName=this.form.problemType;
record.problemType=this.form.problemType;
record.problemId=this.form.problemId;
record.scanMan=this.form.scanMan;
record.scanManCode=this.form.scanManCode;
record.picUrl=this.form.picUrl;
record.remark=this.form.remark;
record.dataFrom="PC";
this.emisWaybillList.push(record);
this.dataMap[this.form.billCode]=record;
}
},
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
let ids = []; let ids = [];
@ -584,4 +701,4 @@ export default {
white-space: nowrap; /* 确保文本在一行内显示 */ white-space: nowrap; /* 确保文本在一行内显示 */
text-overflow: ellipsis; /* 超出部分显示省略号 */ text-overflow: ellipsis; /* 超出部分显示省略号 */
} }
</style> </style>