|
|
@@ -246,6 +246,7 @@ export default {
|
|
|
],
|
|
|
materialCode: null, //色卡物料来源
|
|
|
maskShow: true,
|
|
|
+ controller: null, //取消请求
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
|
@@ -272,11 +273,16 @@ export default {
|
|
|
this.deptId = this.userInfo.deptId; // 当前用户部门id
|
|
|
this.activaPantoneName = this.$route.query.pantoneName; //当前色卡
|
|
|
this.materialCode = this.$route.query.materialCode; // 色卡code
|
|
|
+ this.controller = new AbortController(); //取消请求
|
|
|
this.initData();
|
|
|
},
|
|
|
methods: {
|
|
|
rowKey(row) {
|
|
|
- return this.fromType == 'pantone' ? row['id'] : row['onlyId'];
|
|
|
+ if (this.fromType == 'noVisit' || this.fromType == 'createStore') {
|
|
|
+ return row['onlyId'];
|
|
|
+ } else if (this.fromType == 'pantone') {
|
|
|
+ return row['warehouseCode'];
|
|
|
+ }
|
|
|
},
|
|
|
setTabsItem() {
|
|
|
this.tabsItem = [
|
|
|
@@ -289,8 +295,8 @@ export default {
|
|
|
name: 'createStore',
|
|
|
},
|
|
|
];
|
|
|
- // 2销售部主管显示色卡
|
|
|
- if (this.userInfo.empLevel == '2') {
|
|
|
+ // 业务员不显示色卡
|
|
|
+ if (this.userInfo.empLevel != '3') {
|
|
|
this.tabsItem.push({
|
|
|
title: '色卡',
|
|
|
name: 'pantone',
|
|
|
@@ -306,8 +312,8 @@ export default {
|
|
|
// 请求子级数据时不需要loading
|
|
|
if (!resolve && !tree) {
|
|
|
this.toggleIndex = this.toggleIndex++;
|
|
|
- this.maskShow = true;
|
|
|
}
|
|
|
+ this.maskShow = true;
|
|
|
if (this.fromType == 'noVisit') {
|
|
|
// 未拜访
|
|
|
this.deptId = tree ? tree.onlyId : this.userInfo.deptId;
|
|
|
@@ -321,14 +327,18 @@ export default {
|
|
|
} else if (this.fromType == 'pantone') {
|
|
|
// 色卡
|
|
|
this.firstProp = 'warehouseName';
|
|
|
- let empLevel = tree ? tree.empLevel : null;
|
|
|
- this.getPantoneData(resolve, empLevel);
|
|
|
+ let deptId = tree ? tree.deptId : null;
|
|
|
+ this.getPantoneData(resolve, deptId);
|
|
|
}
|
|
|
},
|
|
|
tabChange(val) {
|
|
|
this.tableList = []; // 清楚tab数
|
|
|
this.tabsItemPantone = {}; // 清楚色卡tab数据
|
|
|
this.fromType = val;
|
|
|
+ if (this.controller) {
|
|
|
+ this.controller.abort();
|
|
|
+ }
|
|
|
+ this.controller = new AbortController(); //取消请求
|
|
|
this.initData();
|
|
|
},
|
|
|
tabChangePantone(val) {
|
|
|
@@ -346,7 +356,8 @@ export default {
|
|
|
},
|
|
|
// 未拜访
|
|
|
selectNoVisitsInfoFun(resolve) {
|
|
|
- selectNoVisitsInfo({ deptId: this.deptId }).then((res) => {
|
|
|
+ selectNoVisitsInfo({ deptId: this.deptId }, this.controller.signal).then((res) => {
|
|
|
+ this.maskShow = false;
|
|
|
if (res.code == 200) {
|
|
|
res.data.forEach((val) => {
|
|
|
if (val.empLevel < 3) val.hasChildren = true;
|
|
|
@@ -355,11 +366,9 @@ export default {
|
|
|
if (resolve) {
|
|
|
resolve && resolve(res.data);
|
|
|
} else {
|
|
|
- this.maskShow = false;
|
|
|
this.tableList = res.data;
|
|
|
}
|
|
|
} else {
|
|
|
- this.maskShow = false;
|
|
|
this.Toast({
|
|
|
message: res.msg,
|
|
|
duration: 5000,
|
|
|
@@ -369,20 +378,20 @@ export default {
|
|
|
},
|
|
|
// 建店
|
|
|
selectPendingCasesInfoFun(resolve) {
|
|
|
- selectPendingCasesInfo({ deptId: this.deptId }).then((res) => {
|
|
|
+ selectPendingCasesInfo({ deptId: this.deptId }, this.controller.signal).then((res) => {
|
|
|
+ this.maskShow = false;
|
|
|
if (res.code == 200) {
|
|
|
res.data.forEach((val) => {
|
|
|
+ // 是否还有子级
|
|
|
if (val.empLevel < 3) val.hasChildren = true;
|
|
|
});
|
|
|
// 是否是子级
|
|
|
if (resolve) {
|
|
|
resolve && resolve(res.data);
|
|
|
} else {
|
|
|
- this.maskShow = false;
|
|
|
this.tableList = res.data;
|
|
|
}
|
|
|
} else {
|
|
|
- this.maskShow = false;
|
|
|
this.Toast({
|
|
|
message: res.msg,
|
|
|
duration: 5000,
|
|
|
@@ -391,10 +400,9 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
// 色卡tab
|
|
|
- getPantoneData(resolve, empLevel) {
|
|
|
+ getPantoneData(resolve, deptId) {
|
|
|
if (JSON.stringify(this.tabsItemPantone) != '{}') {
|
|
|
- // this.tabsItemPantone != {} 不是初次获取tab数据不需要在赋值
|
|
|
- this.getReportMaterialTypeFun(resolve, empLevel);
|
|
|
+ this.getReportMaterialTypeFun(resolve, deptId);
|
|
|
} else {
|
|
|
getReportMaterial().then((res) => {
|
|
|
this.tabsItemPantone = res.data;
|
|
|
@@ -410,22 +418,24 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
// 色卡详情
|
|
|
- getReportMaterialTypeFun(resolve, empLevel) {
|
|
|
- // empLevel 第一次传 null
|
|
|
- getReportMaterialType({ materialCode: this.materialCode, empLevel: empLevel }).then((res) => {
|
|
|
+ getReportMaterialTypeFun(resolve, deptId) {
|
|
|
+ // deptId 第一次传 null 获取当前等级下的数据(不需要当前层级)
|
|
|
+ getReportMaterialType(
|
|
|
+ { materialCode: this.materialCode, deptId: deptId },
|
|
|
+ this.controller.signal
|
|
|
+ ).then((res) => {
|
|
|
+ this.maskShow = false;
|
|
|
if (res.code == 200) {
|
|
|
res.data.colorCardList.forEach((val) => {
|
|
|
- if (val.empLevel < 3) val.hasChildren = true;
|
|
|
+ if (val.isChildren && val.isChildren == 'true') val.hasChildren = true;
|
|
|
});
|
|
|
// 是否是子级
|
|
|
if (resolve) {
|
|
|
resolve && resolve(res.data.colorCardList);
|
|
|
} else {
|
|
|
- this.maskShow = false;
|
|
|
this.tableList = res.data.colorCardList;
|
|
|
}
|
|
|
} else {
|
|
|
- this.maskShow = false;
|
|
|
this.Toast({
|
|
|
message: res.msg,
|
|
|
duration: 5000,
|