md
This commit is contained in:
parent
7aa3bac278
commit
7690e522bc
@ -27,9 +27,11 @@
|
||||
<el-button type="primary" size="mini" style="padding:2px 10px" @click="confirmOk">确定</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<el-option v-for="item in optionItems.filter(el=> !svalue.includes(el.code) )" :key="item.id" :label="item.name" :value="item.code">
|
||||
<el-option v-for="item in optionItems" :key="item.id" :label="item.name" :value="item.code">
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
||||
<!-- .filter(el=> !svalue.includes(el.code) ) -->
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@ -68,19 +70,32 @@ watch: {
|
||||
console.log("=watch==>",this.value);
|
||||
if(this.value) {
|
||||
this.svalue = this.value.split(',');
|
||||
this.queryData(null,this.value,this.value);
|
||||
}else{
|
||||
this.svalue=[];
|
||||
}
|
||||
},
|
||||
|
||||
},
|
||||
created() {
|
||||
console.log("=mounted==>",this.value);
|
||||
if(this.value) {
|
||||
this.svalue = this.value.split(',');
|
||||
this.queryData(null,this.value,this.value);
|
||||
}else{
|
||||
this.svalue=[];
|
||||
}
|
||||
|
||||
},
|
||||
mounted(){
|
||||
console.log("=mounted==>",this.value);
|
||||
if(this.value) {
|
||||
if(this.value) {
|
||||
this.svalue = this.value.split(',');
|
||||
}
|
||||
this.queryData(null,this.value,this.value);
|
||||
this.queryData(null,this.value,this.value);
|
||||
}else{
|
||||
this.svalue=[];
|
||||
}
|
||||
|
||||
},
|
||||
methods: {
|
||||
confirmOk(){
|
||||
@ -115,7 +130,6 @@ methods: {
|
||||
this.$emit('onChange',selCodeStr)
|
||||
},
|
||||
queryData(val,key,sortCodeStr) {
|
||||
|
||||
let queryParams={
|
||||
pageNum: 1,
|
||||
pageSize: 50,
|
||||
@ -123,17 +137,9 @@ methods: {
|
||||
name:val,
|
||||
sortCodeStr:sortCodeStr
|
||||
}
|
||||
|
||||
console.log("queryData--queryParams:",queryParams)
|
||||
|
||||
// console.log("queryData--queryParams:",queryParams)
|
||||
listSimpleEmisSupplier(queryParams).then(response => {
|
||||
this.optionItems=response.rows
|
||||
// this.optionItems.forEach(item => {
|
||||
// if(!(item.code in this.itemMap)){
|
||||
// this.itemMap[item.code]=item;
|
||||
// }
|
||||
// });
|
||||
|
||||
});
|
||||
},
|
||||
reverseArrow(flag) {
|
||||
|
||||
@ -123,8 +123,6 @@
|
||||
this.dispatch('ElFormItem', 'el.form.change', [this.svalue]);
|
||||
},
|
||||
queryData() {
|
||||
|
||||
|
||||
if(!this.transLineCode ){
|
||||
|
||||
if(this.isFistInit && !this.value){
|
||||
|
||||
@ -52,9 +52,9 @@
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column :label="$t('状态')" align="center" prop="uploadStatus" min-width="80" :show-overflow-tooltip="true" >
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.uploadStatus==1" type="success">上传成功</el-tag>
|
||||
<el-tag v-if="scope.row.uploadStatus==0" type="info">待上传</el-tag>
|
||||
<el-tag v-if="scope.row.uploadStatus==-1" type="danger">上传异常</el-tag>
|
||||
<el-tag v-if="scope.row.uploadStatus==1" type="success">成功</el-tag>
|
||||
<el-tag v-if="scope.row.uploadStatus==0" type="info">待处理</el-tag>
|
||||
<el-tag v-if="scope.row.uploadStatus==-1" type="danger">异常</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('异常信息')" align="center" prop="errorInfo" min-width="300" :show-overflow-tooltip="true" >
|
||||
@ -79,7 +79,6 @@
|
||||
<!-- <el-table-column v-for="(item, index) in dynamicCol" :key="index" :label="item.label" :prop="item.prop">
|
||||
</el-table-column> -->
|
||||
|
||||
|
||||
<!-- <el-table-column :label="$t('线路名称')" align="center" prop="lineName" min-width="120" />
|
||||
<el-table-column :label="$t('产品名称')" align="center" prop="productTypeName" min-width="200" />
|
||||
<el-table-column :label="$t('起始网点')" align="center" prop="startSiteName" min-width="100" />
|
||||
@ -148,8 +147,7 @@ export default {
|
||||
|
||||
components: {
|
||||
},
|
||||
dicts: [
|
||||
],
|
||||
dicts: ['emis_cost_fee_type'],
|
||||
data() {
|
||||
return {
|
||||
resetRefreshId:null,
|
||||
@ -172,6 +170,8 @@ export default {
|
||||
selectionList:[],
|
||||
selectionIndexList: [],
|
||||
|
||||
feeItemMap:new Map(),
|
||||
|
||||
// 动态费用列表
|
||||
dynamicCol:[],
|
||||
|
||||
@ -201,6 +201,8 @@ export default {
|
||||
if(this.$store.getters.ownerSiteCode!='88888'){
|
||||
this.queryParams.sendSiteCode=this.$store.getters.ownerSiteCode;
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
mounted() {
|
||||
|
||||
@ -262,8 +264,9 @@ export default {
|
||||
// const header = this.getHeaderRow(worksheet) // 标题
|
||||
const results = XLSX.utils.sheet_to_json(worksheet)
|
||||
|
||||
console.log(results);
|
||||
// console.log(results);
|
||||
|
||||
// 标题头
|
||||
that.dynamicCol=[];
|
||||
for (var key in results[0]) {
|
||||
that.dynamicCol.push(
|
||||
@ -273,9 +276,17 @@ export default {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
console.log("===>dynamicCol=>",that.dynamicCol);
|
||||
this.batchImportData(results);
|
||||
|
||||
// 转换费用类型
|
||||
that.feeItemMap=new Map();;
|
||||
for(let i=0;i<that.dict.type.emis_cost_fee_type.length;i++){
|
||||
let item=that.dict.type.emis_cost_fee_type[i];
|
||||
that.feeItemMap[""+item.label+""]=item.value;
|
||||
}
|
||||
// console.log("===>feeItemMap=>",that.feeItemMap);
|
||||
// console.log("===>dynamicCol=>",that.dynamicCol);
|
||||
that.batchImportData(results);
|
||||
|
||||
|
||||
resolve()
|
||||
}
|
||||
@ -298,13 +309,14 @@ export default {
|
||||
return headers
|
||||
},
|
||||
async batchImportData(results) {
|
||||
const that=this;
|
||||
const _index = 1
|
||||
let loadingInstance = this.$loading({
|
||||
text: '正在解析 ' + _index + ' 数据...'
|
||||
})
|
||||
|
||||
this.orderList = [];
|
||||
|
||||
|
||||
let lastOrderSn = '';
|
||||
let orderIndex = 0;
|
||||
// 组装提交的数据
|
||||
@ -313,32 +325,73 @@ export default {
|
||||
// tst
|
||||
let rowIndex=element['__rowNum__']
|
||||
|
||||
// lineName: element['线路名称'],
|
||||
// productTypeName: element['产品名称'],
|
||||
// startSiteName: element['起始网点'],
|
||||
// nextSiteName: element['下一网点'],
|
||||
// manager: element['线路负责人'],
|
||||
// supplierName: element['供应商名称'],
|
||||
// startDate: parseExcelTime(element['生效时间'],false),
|
||||
// endDate: parseExcelTime(element['失效时间'],false),
|
||||
// remark: element['备注'],
|
||||
|
||||
let orderData={
|
||||
uploadStatus: 0,
|
||||
errorInfo:'',
|
||||
uploadStatus: 0,
|
||||
errorInfo:'',
|
||||
}
|
||||
|
||||
// console.log("===kkkk=>item=>",item)
|
||||
let feeItemList=[];
|
||||
let feeItemPrice=new Map();
|
||||
let errorInfo='';
|
||||
let batchNo=element['批次号'];
|
||||
|
||||
for (const key in element) {
|
||||
if (element.hasOwnProperty(key)) { // 可选:过滤继承的属性
|
||||
console.log(`${key}: ${element[key]}`);
|
||||
if (element.hasOwnProperty(key)) {
|
||||
// console.log(`${key}: ${element[key]}`);
|
||||
this.$set(orderData,key,element[key]) ;
|
||||
// 解析费用数据
|
||||
if(key!='批次号'&&key!='账期'&&key!='备注'){
|
||||
// 获取费用编码
|
||||
// 单价特殊处理
|
||||
let indexPos=key.indexOf("单价");
|
||||
// console.log("===key=indexPos=>",key,indexPos);
|
||||
|
||||
if(indexPos !== -1 ){
|
||||
let feeTypeStr=key.substring(0,indexPos)+"费";
|
||||
// console.log("===feeTypeStr=>",feeTypeStr)
|
||||
if(!(feeTypeStr in that.feeItemMap) ){
|
||||
orderData.uploadStatus=-1;
|
||||
errorInfo=errorInfo+''+key+',';
|
||||
continue
|
||||
}
|
||||
let feeTypeCode=that.feeItemMap[key]
|
||||
feeItemPrice[feeTypeCode]=element[key];
|
||||
}
|
||||
else{
|
||||
if(!(key in that.feeItemMap) ){
|
||||
orderData.uploadStatus=-1;
|
||||
errorInfo=errorInfo+''+key+',';
|
||||
continue
|
||||
}
|
||||
|
||||
let feeItem={
|
||||
feeType:that.feeItemMap[key],
|
||||
price:null,
|
||||
fee:element[key],
|
||||
currency:'CNY'
|
||||
}
|
||||
feeItemList.push(feeItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log("===orderData=>",orderData)
|
||||
if(orderData.uploadStatus==-1){
|
||||
orderData.errorInfo="费用类型:["+errorInfo+"]未配置";
|
||||
}
|
||||
else{
|
||||
// 循环处理费用单价
|
||||
for(let i=0;i<feeItemList.length;i++){
|
||||
let item=feeItemList[i];
|
||||
item.price=feeItemPrice[item.feeType];
|
||||
}
|
||||
this.$set(orderData,"feeItemList",feeItemList) ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// console.log("===orderData=>",orderData)
|
||||
this.tmpDataList.push(orderData);
|
||||
|
||||
}
|
||||
@ -369,6 +422,7 @@ export default {
|
||||
transSignNo: null,
|
||||
supplierCode: null,
|
||||
supplierName: null,
|
||||
billMonth:null,
|
||||
sendPlace: null,
|
||||
destPlace: null,
|
||||
costFee: null,
|
||||
@ -396,19 +450,29 @@ export default {
|
||||
};
|
||||
|
||||
submitOrderForm.batchNo=orderItem['批次号'];
|
||||
submitOrderForm.billMonth=orderItem['账期'];
|
||||
submitOrderForm.remark=orderItem['备注'];
|
||||
submitOrderForm.splitType="1";
|
||||
|
||||
// this.$set(submitOrderForm,'batchNo',orderItem['批次号']);
|
||||
|
||||
try{
|
||||
let batchNo=orderItem['批次号'];
|
||||
// 获取批次信息
|
||||
let qParam = {
|
||||
pageNum:1,
|
||||
pageSize:1,
|
||||
batchNo:orderItem['批次号'],
|
||||
batchNo:batchNo,
|
||||
};
|
||||
let resBatch=await listEmisTmsSiteBatch(qParam);
|
||||
if(resBatch&&resBatch.code==200){
|
||||
|
||||
if(resBatch.rows.length!=1){
|
||||
orderItem.uploadStatus=-1;
|
||||
orderItem.errorInfo='批次号不存在';
|
||||
continue;
|
||||
}
|
||||
|
||||
let batchItem=resBatch.rows[0];
|
||||
submitOrderForm.realTotalWeight=batchItem.transWeight;
|
||||
submitOrderForm.realPieceNumber=batchItem.packNum;
|
||||
@ -421,18 +485,47 @@ export default {
|
||||
submitOrderForm.tradeDate= this.parseTime(batchItem.etd);
|
||||
submitOrderForm.costName=batchItem.batchName;
|
||||
// this.form.costFee=item.startSiteName;
|
||||
submitOrderFormsendPieceSum=batchItem.totalWaybillQty;
|
||||
submitOrderForm.sendPieceSum=batchItem.totalWaybillQty;
|
||||
submitOrderForm.pieceNumber=batchItem.pieceNumber;
|
||||
submitOrderForm.totalWeight=batchItem.totalWeight;
|
||||
submitOrderForm.totalVolume=batchItem.totalVolume;
|
||||
// 获取供应商
|
||||
let spParams={
|
||||
pageNum: 1,
|
||||
pageSize: 1,
|
||||
code:batchItem.supplierCode
|
||||
}
|
||||
let respSp=await listSimpleEmisSupplier(spParams);
|
||||
if(respSp&&respSp.code==200){
|
||||
if(respSp.rows.length==0){
|
||||
orderItem.uploadStatus=-1;
|
||||
orderItem.errorInfo='批次对应供应商不存在';
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else{
|
||||
orderItem.uploadStatus=-1;
|
||||
orderItem.errorInfo='获取供应商失败';
|
||||
continue;
|
||||
}
|
||||
|
||||
// 费用类型
|
||||
this.$set(submitOrderForm,"feeItemList",orderItem.feeItemList) ;
|
||||
|
||||
// 获取供应商
|
||||
// 获取批次关联运单号
|
||||
let billRelList=[];
|
||||
let resBill=await listEmisTmsSiteBatchDtl({batchNo: batchNo});
|
||||
if(resBill.code==200){
|
||||
if(resBill.rows&&resBill.rows.length>0){
|
||||
resBill.rows.forEach(itemWaybill=>{
|
||||
let relItem={...itemWaybill};
|
||||
billRelList.push(relItem);
|
||||
});
|
||||
}
|
||||
}
|
||||
this.$set(submitOrderForm,"billRelList",billRelList)
|
||||
|
||||
|
||||
// 转化费用类型
|
||||
|
||||
|
||||
|
||||
}else{
|
||||
orderItem.uploadStatus=-1;
|
||||
orderItem.errorInfo='批次号不存在';
|
||||
@ -440,6 +533,7 @@ export default {
|
||||
}
|
||||
|
||||
}catch(e){
|
||||
console.log("===>e===>",e);
|
||||
orderItem.uploadStatus=-1;
|
||||
orderItem.errorInfo='数据异常';
|
||||
continue;
|
||||
@ -475,8 +569,6 @@ export default {
|
||||
|
||||
this.openUploadForm = false;
|
||||
|
||||
|
||||
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
|
||||
@ -525,6 +525,7 @@ export default {
|
||||
async onSelecTmsBatch(item){
|
||||
|
||||
// 基础信息
|
||||
this.form.batchNo=item.batchNo;
|
||||
this.form.realTotalWeight=item.transWeight;
|
||||
this.form.realPieceNumber=item.packNum;
|
||||
this.form.transType=item.transType;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user