This commit is contained in:
linfso 2024-05-25 22:22:10 +08:00
parent 8999e81a03
commit dd3b50d40d
8 changed files with 154 additions and 109 deletions

View File

@ -164,7 +164,6 @@ export default {
}, },
watch: { watch: {
value(newVal) { value(newVal) {
debugger;
this.datetimeRange = newVal; this.datetimeRange = newVal;
}, },
datetimeRange(newVal, oldVal) { datetimeRange(newVal, oldVal) {

View File

@ -86,7 +86,7 @@
this.dispatch('ElFormItem', 'el.form.change', [this.svalue]); this.dispatch('ElFormItem', 'el.form.change', [this.svalue]);
}, },
remoteDebounce(val,key){ remoteDebounce(val,key){
debounce(this.queryData(val,key),1500); debounce(this.queryData(val,key),1000);
}, },
queryData(val,key) { queryData(val,key) {
this.optionItems=[]; this.optionItems=[];

View File

@ -1,14 +1,16 @@
<template> <template>
<el-select <el-select
:loading="loading" style="width:100%"
filterable filterable
clearable clearable
v-model="svalue" v-model="svalue"
:placeholder="placeholder"
:filter-method="dataFilter" no-data-text=""
style="width: 100%;" :placeholder="placeholder"
:disabled="disabled" @change="onChange"
@change="onChange"> @click.native="onClick"
>
<el-option v-for="item in optionItems" :key="item.destCode" :label="item.destName" :value="item.destCode" ></el-option> <el-option v-for="item in optionItems" :key="item.destCode" :label="item.destName" :value="item.destCode" ></el-option>
</el-select> </el-select>
@ -48,69 +50,70 @@
data() { data() {
return { return {
loading:false, loading:false,
bakOptionItems:[],
optionItems: [],
svalue: this.value, svalue: this.value,
optionDefault:null, optionItems: [],
dataMap:new Map(), // 缺省值
defaultItems: null,
}; };
}, },
watch: { watch: {
value(newVal) { value(newVal,oldVal) {
this.svalue = newVal; if(this.value!=null ){
}, this.svalue=this.value;
// 判断默认值中是否存在,若存在则不继续查询
if(this.optionItems){
let selItem = this.optionItems.find(item => item.destCode == this.svalue);
if(selItem){
return;
}
}
this.queryData(null,this.svalue);
}
},
countryCode(newVal, oldVal) { countryCode(newVal, oldVal) {
this.initData(); if(newVal!=oldVal){
this.defaultItems=null;
}
}, },
// lineCode(newVal, oldVal) {
// this.initData();
// },
}, },
created() { created() {
// if(this.isInitiated || this.svalue){ if(this.svalue!=null){
this.queryData(null,this.svalue);
// } }
this.initData();
}, },
methods: { methods: {
onClick(){
// 第一次点击时需要初始化
if(!this.defaultItems){
this.queryData(null,null);
}else{
this.optionItems = [...this.defaultItems];
}
},
onChange() { onChange() {
this.$emit("input", this.svalue); this.$emit("input", this.svalue);
let itemData ={}; let itemData=this.optionItems.find(item=> item.destCode === this.svalue);
this.optionItems.forEach(item=>{
if(item.destCode === this.svalue){
itemData = item;
}
});
this.$emit("onChange",itemData); this.$emit("onChange",itemData);
this.optionItems = this.bakOptionItems;
}, },
queryData(val,key) {
initData() {
this.loading = true; this.loading = true;
// ,lineCode:this.lineCode let queryParams = {
let queryParams = {pageNumber:1,pageSize:150,country:this.countryCode}; pageNum:1,
this.bakOptionItems=[]; pageSize:150,
this.optionItems=[]; country:this.countryCode
};
this.optionItems=[];
listSimpleEmisDestination(queryParams).then(response => { listSimpleEmisDestination(queryParams).then(response => {
this.loading = false; this.loading = false;
this.bakOptionItems = response.rows; this.optionItems =response.rows;
this.optionItems =this.bakOptionItems; // 初始值存储
if(key==null && val==null){
this.defaultItems=[...this.optionItems]
}
}); });
}, },
dataFilter(val) {
this.optionDefault = val
if (val) {
let searchVal = val.toLowerCase();
this.optionItems = this.bakOptionItems.filter(item => {
if (item.destCode.indexOf(searchVal) != -1 || item.destName.toLowerCase().indexOf(searchVal) != -1 ) {
return true
}
})
} else {
this.optionItems = this.bakOptionItems;
}
},
} }
}; };
</script> </script>

View File

@ -36,8 +36,8 @@
ref="inputValue" ref="inputValue"
:value="slable" :value="slable"
:placeholder="placeholder" :placeholder="placeholder"
@input="handleInput" @input="onInput"
@focus="onFocus" @click.native="onClick"
@blur="onBlur" @blur="onBlur"
@clear="onClear" @clear="onClear"
clearable clearable
@ -102,6 +102,8 @@ import { getStaffList } from "@/api/emis/emisStaff";
isInputing: false, isInputing: false,
isInit:true,
queryParams:{ queryParams:{
pageNum:1, pageNum:1,
pageSize:5, pageSize:5,
@ -114,7 +116,7 @@ import { getStaffList } from "@/api/emis/emisStaff";
}, },
watch: { watch: {
value(newVal,oldVal) { value(newVal,oldVal) {
if(this.value!=null){ if(this.value!=null && this.isInit){
this.svalue=this.value; this.svalue=this.value;
this.queryData(null,this.svalue); this.queryData(null,this.svalue);
} }
@ -133,12 +135,14 @@ import { getStaffList } from "@/api/emis/emisStaff";
this.createdId = String(new Date().getTime()) this.createdId = String(new Date().getTime())
}, },
created() { created() {
if(this.svalue!=null){ if(this.value!=null && this.isInit){
this.queryData(null,this.svalue); this.svalue=this.value;
this.queryData(null,this.svalue);
} }
}, },
methods: { methods: {
onFocus(){ onClick(){
this.isInit=false;
// 第一次点击时需要初始化 // 第一次点击时需要初始化
if(!this.defaultItems){ if(!this.defaultItems){
this.queryParams.pageNum=1; this.queryParams.pageNum=1;
@ -149,7 +153,7 @@ import { getStaffList } from "@/api/emis/emisStaff";
} }
// this.$refs.popoverRef.doShow(); // this.$refs.popoverRef.doShow();
}, },
handleInput(val) { onInput(val) {
if(val == null ) return; if(val == null ) return;
this.isInputing = true; this.isInputing = true;
@ -176,10 +180,6 @@ import { getStaffList } from "@/api/emis/emisStaff";
}; };
} }
}, },
changePage(cur) {
this.queryParams.pageNum = cur
this.queryData()
},
onClear(el){ onClear(el){
this.slable = null; this.slable = null;
this.svalue = null; this.svalue = null;
@ -196,6 +196,10 @@ import { getStaffList } from "@/api/emis/emisStaff";
this.$emit("input", this.svalue); this.$emit("input", this.svalue);
this.dispatch('ElFormItem', 'el.form.blur', [this.svalue]); this.dispatch('ElFormItem', 'el.form.blur', [this.svalue]);
}, },
changePage(cur) {
this.queryParams.pageNum = cur
this.queryData()
},
queryData(val,key) { queryData(val,key) {
this.loading = true; this.loading = true;

View File

@ -7,14 +7,14 @@
style="width: 100%" style="width: 100%"
clearable clearable
filterable filterable
@focus="onFocus" @click.native="onClick"
@clear="onClear" @clear="onClear"
@change="handleChange" @blur="onBlur"
@change="onChange"
></el-cascader> ></el-cascader>
</template> </template>
<script> <script>
// import { listSimpleEmisCountry} from "@/api/emis/emisCountry";
import { listSimpleEmisTransLine } from "@/api/emis/emisTransLine"; import { listSimpleEmisTransLine } from "@/api/emis/emisTransLine";
import { listSimpleEmisTransProduct } from "@/api/emis/emisTransProduct"; import { listSimpleEmisTransProduct } from "@/api/emis/emisTransProduct";
@ -38,6 +38,7 @@ export default {
return { return {
resetCascader:0, resetCascader:0,
svalue: this.value, svalue: this.value,
isInit: true,
lineCode:null, lineCode:null,
prodCode:null, prodCode:null,
props: { props: {
@ -55,12 +56,10 @@ export default {
let parentCode = node.value; let parentCode = node.value;
this.queryData(level,parentCode) this.queryData(level,parentCode)
.then((res) => { .then((res) => {
// console.log(res);
if (res.code != 200) { if (res.code != 200) {
return; return;
} }
res.rows.map((item) => { res.rows.map((item) => {
if(level==0){ if(level==0){
let obj = { let obj = {
value: item.lineCode, value: item.lineCode,
@ -77,7 +76,6 @@ export default {
}; };
nodes.push(obj); nodes.push(obj);
} }
}); });
// resolve 节点返回 // resolve 节点返回
@ -93,20 +91,18 @@ export default {
watch: { watch: {
value(newVal) { value(newVal) {
this.svalue = newVal; this.svalue = newVal;
if(this.svalue!=null) { if(this.svalue!=null && this.isInit) {
this.lineCode=this.svalue[0]; this.lineCode=this.svalue[0];
this.prodCode=this.svalue[1]; this.prodCode=this.svalue[1];
this.resetCascader++
} }
}, },
countryCode(newVal) { countryCode(newVal) {
this.queryData(0,0);
this.resetCascader++ this.resetCascader++
} }
}, },
created() { created() {
if(this.lineCode == null || this.prodCode != null || this.countryCode!= null){
this.queryData(0,0);
}
}, },
methods: { methods: {
onClear(){ onClear(){
@ -114,25 +110,37 @@ export default {
this.$emit("input", this.svalue); this.$emit("input", this.svalue);
this.$emit("onChange", this.svalue); this.$emit("onChange", this.svalue);
}, },
onFocus(){ onBlur(){
this.$emit("input", this.svalue);
this.$emit("onChange", this.svalue);
},
onClick(){
this.isInit = false;
this.lineCode=null; this.lineCode=null;
this.prodCode=null; this.prodCode=null;
this.queryData(0,0); this.queryData(0,0);
}, },
onChange(value) {
this.$emit("input", this.svalue);
this.$emit("onChange", this.svalue);
},
async queryData(level,parentCode) { async queryData(level,parentCode) {
// 第1级是线路 // 第1级是线路
if(level == 0){ if(level == 0){
let queryParams={ let queryParams={
pageNum:1,
pageSize:30,
country:this.countryCode, country:this.countryCode,
lineCode:this.lineCode, lineCode:this.lineCode,
}; };
let res=await listSimpleEmisTransLine(queryParams); let res=await listSimpleEmisTransLine(queryParams);
return res; return res;
} }
// 产品 // 产品
if(level == 1){ if(level == 1){
let queryParams={ let queryParams={
pageNum:1,
pageSize:30,
transLineCode:parentCode, transLineCode:parentCode,
prodCode:this.prodCode, prodCode:this.prodCode,
status:1 status:1
@ -140,12 +148,8 @@ export default {
let res=await listSimpleEmisTransProduct(queryParams); let res=await listSimpleEmisTransProduct(queryParams);
return res; return res;
} }
},
},
handleChange(value) {
this.$emit("input", this.svalue);
this.$emit("onChange", this.svalue);
},
}, },
}; };
</script> </script>

View File

@ -724,16 +724,16 @@ export default {
}; };
}, },
created() { created() {
this.getList();
this.queryOrderType="1";
this.queryOrderDateType="1";
const end = new Date() const end = new Date()
const start = new Date() const start = new Date()
start.setHours(0,0,0,0) start.setHours(0,0,0,0)
end.setHours(23,59,59,0) end.setHours(23,59,59,0)
this.dateTimeRange=[start,end]; this.dateTimeRange=[start,end];
this.getList();
this.queryOrderType="1";
this.queryOrderDateType="1";
// 调整表格的高度,不允许滚动 // 调整表格的高度,不允许滚动
this.$nextTick(function() { this.$nextTick(function() {
let queryFormEl = this.$refs.queryForm.$el; let queryFormEl = this.$refs.queryForm.$el;
@ -741,6 +741,13 @@ export default {
this.tableHeight = window.innerHeight - tableH; 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];
},
methods: { methods: {
/** 查询运单列表列表 */ /** 查询运单列表列表 */
getList() { getList() {

View File

@ -8,7 +8,6 @@
</template> </template>
<div> <div>
<el-row :gutter="0" style="display: flex;flex-wrap: wrap;"> <el-row :gutter="0" style="display: flex;flex-wrap: wrap;">
@ -296,7 +295,7 @@
<el-col :span="24"> <el-col :span="24">
<el-form-item label="国家地区" prop="reciever.province"> <el-form-item label="国家地区" prop="reciever.province">
<div style="display:inline-flex"> <div style="display:inline-flex">
<country-picker2 v-model="form.reciever.country" ></country-picker2> <country-picker2 v-model="form.reciever.country" ></country-picker2>
<ProvincePicker2 v-model="form.reciever.province" :countryCode="form.reciever.country" style="margin-left:5px" @onChange="handleCalcDestSite" ></ProvincePicker2> <ProvincePicker2 v-model="form.reciever.province" :countryCode="form.reciever.country" style="margin-left:5px" @onChange="handleCalcDestSite" ></ProvincePicker2>
<city-picker2 v-model="form.reciever.city" :parentCode="form.reciever.province" style="margin-left:5px"></city-picker2> <city-picker2 v-model="form.reciever.city" :parentCode="form.reciever.province" style="margin-left:5px"></city-picker2>
<district-picker2 v-model="form.reciever.county" :parentCode="form.reciever.city" style="margin-left:5px"></district-picker2> <district-picker2 v-model="form.reciever.county" :parentCode="form.reciever.city" style="margin-left:5px"></district-picker2>
@ -775,6 +774,7 @@ import PdfUtils from '@/utils/pdfUtils'
export default { export default {
// name: "WaybillRecord",
name: "WaybillModify", name: "WaybillModify",
// props:{ // props:{
// billCode:{ // billCode:{
@ -844,7 +844,7 @@ data() {
], ],
reciever:{ reciever:{
name: [ name: [
{ required: true, message: "收货人名不能为空", trigger: "blur" } { required: true, message: "收货人名不能为空", trigger: ["blur",'change'] }
], ],
phone: [ phone: [
{ required: true, message: "收货人手机号不能为空", trigger: "blur" } { required: true, message: "收货人手机号不能为空", trigger: "blur" }
@ -870,7 +870,7 @@ data() {
}, },
sender:{ sender:{
name: [ name: [
{ required: true, message: "寄件人名不能为空", trigger: "blur" } { required: true, message: "寄件人名不能为空", trigger: ["blur",'change'] }
], ],
phone: [ phone: [
{ required: true, message: "寄件人手机号不能为空", trigger: "blur" } { required: true, message: "寄件人手机号不能为空", trigger: "blur" }
@ -1394,27 +1394,41 @@ methods: {
this.form.reciever.address=value.address; this.form.reciever.address=value.address;
this.form.reciever.company=value.company; this.form.reciever.company=value.company;
this.handleCalcDestSite();
}, },
// 计算目的站点 // 计算目的站点
handleCalcDestSite(){ handleCalcDestSite(){
// 初始化不计算
// if(!this.isNeedSave){ if(this.form.reciever.country != this.form.destinationCountry){
// return; this.$confirm('收件国和目的国不一致,请调整!', '提示', {
// } confirmButtonText: '确认',
console.log("1111=>"+this.form.reciever.province) cancelButtonText: '返回',
type: 'warning'
}).then(() => {
this.calcDestSite();
}).catch(() => {
})
}else{
this.calcDestSite();
}
},
calcDestSite(){
let queryParams = { let queryParams = {
province:this.form.reciever.province province:this.form.reciever.province
}; };
if(this.form.reciever.province){ if(this.form.reciever.province){
getDestSite(queryParams).then(response => { getDestSite(queryParams).then(response => {
console.log(response); console.log(response);
this.form.destinationCode = response.data.destCode+''; this.form.destinationCode = response.data.destCode+'';
this.form.dispatchUnderlingSiteCode= response.data.siteCode;
this.form.dispatchSiteCode= response.data.siteCode; this.form.dispatchSiteCode= response.data.siteCode;
this.form.dispatchSite = response.data.siteName;
this.form.dispatchUnderlingSiteCode= response.data.siteCode;
this.form.dispatchUnderlingSite= response.data.siteName; this.form.dispatchUnderlingSite= response.data.siteName;
this.form.dispatchSite= response.data.siteName;
}); });
} }

View File

@ -296,7 +296,7 @@
<el-col :span="24"> <el-col :span="24">
<el-form-item label="国家地区" prop="reciever.province"> <el-form-item label="国家地区" prop="reciever.province">
<div style="display:inline-flex"> <div style="display:inline-flex">
<country-picker2 v-model="form.reciever.country" ></country-picker2> <country-picker2 v-model="form.reciever.country" ></country-picker2>
<ProvincePicker2 v-model="form.reciever.province" :countryCode="form.reciever.country" style="margin-left:5px" @onChange="handleCalcDestSite" ></ProvincePicker2> <ProvincePicker2 v-model="form.reciever.province" :countryCode="form.reciever.country" style="margin-left:5px" @onChange="handleCalcDestSite" ></ProvincePicker2>
<city-picker2 v-model="form.reciever.city" :parentCode="form.reciever.province" style="margin-left:5px"></city-picker2> <city-picker2 v-model="form.reciever.city" :parentCode="form.reciever.province" style="margin-left:5px"></city-picker2>
<district-picker2 v-model="form.reciever.county" :parentCode="form.reciever.city" style="margin-left:5px"></district-picker2> <district-picker2 v-model="form.reciever.county" :parentCode="form.reciever.city" style="margin-left:5px"></district-picker2>
@ -1395,27 +1395,41 @@ methods: {
this.form.reciever.address=value.address; this.form.reciever.address=value.address;
this.form.reciever.company=value.company; this.form.reciever.company=value.company;
this.handleCalcDestSite();
}, },
// 计算目的站点 // 计算目的站点
handleCalcDestSite(){ handleCalcDestSite(){
// 初始化不计算
// if(!this.isNeedSave){ if(this.form.reciever.country != this.form.destinationCountry){
// return; this.$confirm('收件国和目的国不一致,请调整!', '提示', {
// } confirmButtonText: '确认',
console.log("1111=>"+this.form.reciever.province) cancelButtonText: '返回',
type: 'warning'
}).then(() => {
this.calcDestSite();
}).catch(() => {
})
}else{
this.calcDestSite();
}
},
calcDestSite(){
let queryParams = { let queryParams = {
province:this.form.reciever.province province:this.form.reciever.province
}; };
if(this.form.reciever.province){ if(this.form.reciever.province){
getDestSite(queryParams).then(response => { getDestSite(queryParams).then(response => {
console.log(response); console.log(response);
this.form.destinationCode = response.data.destCode+''; this.form.destinationCode = response.data.destCode+'';
this.form.dispatchUnderlingSiteCode= response.data.siteCode;
this.form.dispatchSiteCode= response.data.siteCode; this.form.dispatchSiteCode= response.data.siteCode;
this.form.dispatchSite = response.data.siteName;
this.form.dispatchUnderlingSiteCode= response.data.siteCode;
this.form.dispatchUnderlingSite= response.data.siteName; this.form.dispatchUnderlingSite= response.data.siteName;
this.form.dispatchSite= response.data.siteName;
}); });
} }