|
|
|
@ -13,8 +13,8 @@
|
|
|
|
|
<Option v-for="item in regionList" :value="item.id" :key="item.id">{{ item.name }}</Option>
|
|
|
|
|
</Select>
|
|
|
|
|
<span style="margin: 0 10px">零售公司</span>
|
|
|
|
|
<Select filterable placeholder="请选择零售公司" v-model="orgId" @on-change="orgSelect" style="width:190px" size="small">
|
|
|
|
|
<Option v-for="item in orgList" :value="item.id" :key="item.id">{{ item.name }}</Option>
|
|
|
|
|
<Select filterable placeholder="请选择零售公司" v-model="companyId" @on-change="companySelect" style="width:190px" size="small">
|
|
|
|
|
<Option v-for="item in companyList" :value="item.id" :key="item.id">{{ item.name }}</Option>
|
|
|
|
|
</Select>
|
|
|
|
|
<span style="margin: 0 10px">客户</span>
|
|
|
|
|
<Select filterable placeholder="请选择客户" v-model="customerId" style="width:190px" size="small">
|
|
|
|
@ -96,8 +96,8 @@
|
|
|
|
|
regionList: [],
|
|
|
|
|
regionId: 0,
|
|
|
|
|
//零售公司list
|
|
|
|
|
orgList: [],
|
|
|
|
|
orgId: 0,
|
|
|
|
|
companyList: [],
|
|
|
|
|
companyId: 0,
|
|
|
|
|
//客户list
|
|
|
|
|
customerList: [],
|
|
|
|
|
customerId: 0,
|
|
|
|
@ -128,25 +128,25 @@
|
|
|
|
|
regionSelect: function(){
|
|
|
|
|
let regionId = this.regionId;
|
|
|
|
|
if(regionId === 0){
|
|
|
|
|
this.orgList = this.organizationalList.filter(item => item.level === 2);
|
|
|
|
|
this.companyList = this.organizationalList.filter(item => item.level === 2);
|
|
|
|
|
this.customerList = this.organizationalList.filter(item => item.level === 3);
|
|
|
|
|
}else{
|
|
|
|
|
this.orgList = this.organizationalList.filter(item => item.parentId === regionId && item.level === 2);
|
|
|
|
|
let orgIds = this.orgList.map(item => item.id);
|
|
|
|
|
this.customerList = this.organizationalList.filter(item => orgIds.indexOf(item.parentId) !== -1 && item.level === 3);
|
|
|
|
|
this.companyList = this.organizationalList.filter(item => item.parentId === regionId && item.level === 2);
|
|
|
|
|
let companyIds = this.companyList.map(item => item.id);
|
|
|
|
|
this.customerList = this.organizationalList.filter(item => companyIds.indexOf(item.parentId) !== -1 && item.level === 3);
|
|
|
|
|
}
|
|
|
|
|
this.insertAllOption();
|
|
|
|
|
this.orgId = 0;
|
|
|
|
|
this.companyId = 0;
|
|
|
|
|
this.customerId = 0;
|
|
|
|
|
},
|
|
|
|
|
//零售公司选择
|
|
|
|
|
orgSelect: function(){
|
|
|
|
|
let orgId = this.orgId;
|
|
|
|
|
if(orgId === 0){
|
|
|
|
|
let orgIds = this.orgList.map(item => item.id);
|
|
|
|
|
this.customerList = this.organizationalList.filter(item => orgIds.indexOf(item.parentId) !== -1 && item.level === 3);
|
|
|
|
|
companySelect: function(){
|
|
|
|
|
let companyId = this.companyId;
|
|
|
|
|
if(companyId === 0){
|
|
|
|
|
let companyIds = this.companyList.map(item => item.id);
|
|
|
|
|
this.customerList = this.organizationalList.filter(item => companyIds.indexOf(item.parentId) !== -1 && item.level === 3);
|
|
|
|
|
}else{
|
|
|
|
|
this.customerList = this.organizationalList.filter(item => item.parentId === orgId && item.level === 3);
|
|
|
|
|
this.customerList = this.organizationalList.filter(item => item.parentId === companyId && item.level === 3);
|
|
|
|
|
}
|
|
|
|
|
this.insertAllOption();
|
|
|
|
|
this.customerId = 0;
|
|
|
|
@ -156,8 +156,8 @@
|
|
|
|
|
if(this.regionList.length === 0 || this.regionList[0].id !== 0){
|
|
|
|
|
this.regionList.splice(0,0, {"id":0, "name":"全部"});
|
|
|
|
|
}
|
|
|
|
|
if(this.orgList.length === 0 || this.orgList[0].id !== 0){
|
|
|
|
|
this.orgList.splice(0, 0, {"id":0, "name":"全部"});
|
|
|
|
|
if(this.companyList.length === 0 || this.companyList[0].id !== 0){
|
|
|
|
|
this.companyList.splice(0, 0, {"id":0, "name":"全部"});
|
|
|
|
|
}
|
|
|
|
|
if(this.customerList.length === 0 || this.customerList[0].id !== 0){
|
|
|
|
|
this.customerList.splice(0, 0, {"id":0, "name":"全部"});
|
|
|
|
@ -183,7 +183,7 @@
|
|
|
|
|
pageNum : 1,
|
|
|
|
|
pageSize : that.totalSize,
|
|
|
|
|
regionId : that.regionId === 0 ? null : that.regionId,
|
|
|
|
|
companyId : that.orgId === 0 ? null : that.orgId,
|
|
|
|
|
companyId : that.companyId === 0 ? null : that.companyId,
|
|
|
|
|
customerId : that.customerId === 0 ? null : that.customerId,
|
|
|
|
|
startTime : this.formartDate(that.dateRange[0], "YYYY-MM-DD"),
|
|
|
|
|
endTime : this.formartDate(that.dateRange[1], "YYYY-MM-DD", true),
|
|
|
|
@ -227,7 +227,7 @@
|
|
|
|
|
pageNum : that.pageNum,
|
|
|
|
|
pageSize : that.pageSize,
|
|
|
|
|
regionId : that.regionId === 0 ? null : that.regionId,
|
|
|
|
|
companyId : that.orgId === 0 ? null : that.orgId,
|
|
|
|
|
companyId : that.companyId === 0 ? null : that.companyId,
|
|
|
|
|
customerId : that.customerId === 0 ? null : that.customerId,
|
|
|
|
|
startTime : this.formartDate(that.dateRange[0], "YYYY-MM-DD"),
|
|
|
|
|
endTime : this.formartDate(that.dateRange[1], "YYYY-MM-DD", true),
|
|
|
|
@ -269,7 +269,7 @@
|
|
|
|
|
if(data){
|
|
|
|
|
that.organizationalList = data;
|
|
|
|
|
that.regionList = that.organizationalList.filter(item => item.level === 1);
|
|
|
|
|
that.orgList = that.organizationalList.filter(item => item.level === 2);
|
|
|
|
|
that.companyList = that.organizationalList.filter(item => item.level === 2);
|
|
|
|
|
that.customerList = that.organizationalList.filter(item => item.level === 3);
|
|
|
|
|
}
|
|
|
|
|
//插入全部选项
|
|
|
|
|