|
|
@@ -6,9 +6,9 @@
|
|
|
<div class="tabBox">
|
|
|
<van-tabs class="myTab" v-model="activeTabName" color="#0057ba" @change="tabChange">
|
|
|
<van-tab
|
|
|
+ v-for="(item, index) in tabsItem"
|
|
|
:title="item.title"
|
|
|
:name="item.name"
|
|
|
- v-for="(item, index) in tabsItem"
|
|
|
:key="index"></van-tab>
|
|
|
</van-tabs>
|
|
|
<van-tabs
|
|
|
@@ -26,13 +26,14 @@
|
|
|
</div>
|
|
|
<div class="content">
|
|
|
<el-table
|
|
|
+ v-if="fromType"
|
|
|
:data="tableList"
|
|
|
:load="load"
|
|
|
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
|
|
border
|
|
|
class="elTreeTable"
|
|
|
lazy
|
|
|
- row-key="id"
|
|
|
+ :row-key="rowKey"
|
|
|
:key="toggleIndex">
|
|
|
<el-table-column
|
|
|
class="firstName"
|
|
|
@@ -97,10 +98,6 @@ export default {
|
|
|
title: '建店',
|
|
|
name: 'createStore',
|
|
|
},
|
|
|
- {
|
|
|
- title: '色卡',
|
|
|
- name: 'pantone',
|
|
|
- },
|
|
|
],
|
|
|
activePantoneTabName: '', //色卡tabName
|
|
|
tabsItemPantone: {}, //色卡tabItem
|
|
|
@@ -142,7 +139,7 @@ export default {
|
|
|
label: '同B店',
|
|
|
childredColumn: [
|
|
|
{
|
|
|
- label: '(近2月)',
|
|
|
+ label: '(近3月)',
|
|
|
prop: 'tongBNotVisited',
|
|
|
},
|
|
|
],
|
|
|
@@ -240,6 +237,7 @@ export default {
|
|
|
},
|
|
|
],
|
|
|
materialCode: null, //色卡物料来源
|
|
|
+ // rowKey: 'id', //tab row-key
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
|
@@ -254,6 +252,7 @@ export default {
|
|
|
activated() {
|
|
|
this.empLevel = this.userInfo.empLevel;
|
|
|
this.firstLabel = this.empLevel == '1' ? '组织名称/大区主管' : '组织名称/销售部主管';
|
|
|
+ this.setTabsItem();
|
|
|
this.fromType = this.$route.query.fromType; // fromType: 'noVisit':未拜访; 'createStore':建店; 'pantone':色卡
|
|
|
// this.tableColumn = this[this.fromType]; //初始化表格头
|
|
|
// this.activeTabName = this.fromType;
|
|
|
@@ -263,21 +262,35 @@ export default {
|
|
|
this.initData();
|
|
|
},
|
|
|
methods: {
|
|
|
+ rowKey(row) {
|
|
|
+ return this.fromType == 'pantone' ? row['id'] : row['onlyId'];
|
|
|
+ },
|
|
|
+ setTabsItem() {
|
|
|
+ if (this.empLevel == '2')
|
|
|
+ this.tabsItem.push({
|
|
|
+ title: '色卡',
|
|
|
+ name: 'pantone',
|
|
|
+ });
|
|
|
+ },
|
|
|
initData(resolve, tree) {
|
|
|
+ this.toggleIndex = this.toggleIndex++;
|
|
|
if (this.fromType == 'noVisit') {
|
|
|
// 未拜访
|
|
|
- if (tree) this.deptId = tree.onlyId;
|
|
|
+ this.deptId = tree ? tree.onlyId : this.userInfo.deptId;
|
|
|
this.firstProp = 'onlyName';
|
|
|
+ // this.rowKey = 'onlyId';
|
|
|
this.selectNoVisitsInfoFun(resolve);
|
|
|
} else if (this.fromType == 'createStore') {
|
|
|
// 建店
|
|
|
- if (tree) this.deptId = tree.onlyId;
|
|
|
+ this.deptId = tree ? tree.onlyId : this.userInfo.deptId;
|
|
|
this.firstProp = 'onlyName';
|
|
|
+ // this.rowKey = 'onlyId';
|
|
|
this.selectPendingCasesInfoFun(resolve);
|
|
|
} else if (this.fromType == 'pantone') {
|
|
|
// 色卡
|
|
|
this.firstProp = 'warehouseName';
|
|
|
let empLevel = tree ? tree.empLevel : null;
|
|
|
+ // this.rowKey = 'id';
|
|
|
this.getPantoneData(resolve, empLevel);
|
|
|
}
|
|
|
},
|
|
|
@@ -286,13 +299,11 @@ export default {
|
|
|
this.tabsItemPantone = {}; // 清楚色卡tab数据
|
|
|
this.fromType = val;
|
|
|
this.initData();
|
|
|
- this.toggleIndex = this.toggleIndex++;
|
|
|
},
|
|
|
tabChangePantone(val) {
|
|
|
this.tableList = [];
|
|
|
this.materialCode = this.tabsItemPantone[val].materialCode;
|
|
|
this.initData();
|
|
|
- this.toggleIndex = this.toggleIndex++;
|
|
|
},
|
|
|
onClickLeft() {
|
|
|
this.$router.go(-1);
|
|
|
@@ -305,28 +316,42 @@ export default {
|
|
|
// 未拜访
|
|
|
selectNoVisitsInfoFun(resolve) {
|
|
|
selectNoVisitsInfo({ deptId: this.deptId }).then((res) => {
|
|
|
- res.data.forEach((val) => {
|
|
|
- if (val.onLevel < 3) val.hasChildren = true;
|
|
|
- });
|
|
|
- // 是否是子级
|
|
|
- if (resolve) {
|
|
|
- resolve && resolve(res.data);
|
|
|
+ if (res.code == 200) {
|
|
|
+ res.data.forEach((val) => {
|
|
|
+ if (val.empLevel < 3) val.hasChildren = true;
|
|
|
+ });
|
|
|
+ // 是否是子级
|
|
|
+ if (resolve) {
|
|
|
+ resolve && resolve(res.data);
|
|
|
+ } else {
|
|
|
+ this.tableList = res.data;
|
|
|
+ }
|
|
|
} else {
|
|
|
- this.tableList = res.data;
|
|
|
+ this.Toast({
|
|
|
+ message: res.msg,
|
|
|
+ duration: 5000,
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
// 建店
|
|
|
selectPendingCasesInfoFun(resolve) {
|
|
|
selectPendingCasesInfo({ deptId: this.deptId }).then((res) => {
|
|
|
- res.data.forEach((val) => {
|
|
|
- if (val.onLevel < 3) val.hasChildren = true;
|
|
|
- });
|
|
|
- // 是否是子级
|
|
|
- if (resolve) {
|
|
|
- resolve && resolve(res.data);
|
|
|
+ if (res.code == 200) {
|
|
|
+ res.data.forEach((val) => {
|
|
|
+ if (val.empLevel < 3) val.hasChildren = true;
|
|
|
+ });
|
|
|
+ // 是否是子级
|
|
|
+ if (resolve) {
|
|
|
+ resolve && resolve(res.data);
|
|
|
+ } else {
|
|
|
+ this.tableList = res.data;
|
|
|
+ }
|
|
|
} else {
|
|
|
- this.tableList = res.data;
|
|
|
+ this.Toast({
|
|
|
+ message: res.msg,
|
|
|
+ duration: 5000,
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
@@ -353,14 +378,21 @@ export default {
|
|
|
getReportMaterialTypeFun(resolve, empLevel) {
|
|
|
// empLevel 第一次传 null
|
|
|
getReportMaterialType({ materialCode: this.materialCode, empLevel: empLevel }).then((res) => {
|
|
|
- res.data.colorCardList.forEach((val) => {
|
|
|
- if (val.empLevel < 3) val.hasChildren = true;
|
|
|
- });
|
|
|
- // 是否是子级
|
|
|
- if (resolve) {
|
|
|
- resolve && resolve(res.data.colorCardList);
|
|
|
+ if (res.code == 200) {
|
|
|
+ res.data.colorCardList.forEach((val) => {
|
|
|
+ if (val.empLevel < 3) val.hasChildren = true;
|
|
|
+ });
|
|
|
+ // 是否是子级
|
|
|
+ if (resolve) {
|
|
|
+ resolve && resolve(res.data.colorCardList);
|
|
|
+ } else {
|
|
|
+ this.tableList = res.data.colorCardList;
|
|
|
+ }
|
|
|
} else {
|
|
|
- this.tableList = res.data.colorCardList;
|
|
|
+ this.Toast({
|
|
|
+ message: res.msg,
|
|
|
+ duration: 5000,
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
},
|