|
|
@@ -32,16 +32,16 @@
|
|
|
border
|
|
|
class="elTreeTable"
|
|
|
lazy
|
|
|
- row-key="onlyId"
|
|
|
+ row-key="id"
|
|
|
:key="toggleIndex">
|
|
|
<el-table-column
|
|
|
class="firstName"
|
|
|
:label="firstLabel"
|
|
|
- prop="onlyName"
|
|
|
+ :prop="firstProp"
|
|
|
align="center"
|
|
|
width="120">
|
|
|
<template slot-scope="scope">
|
|
|
- <span>{{ scope.row.onlyName }}</span>
|
|
|
+ <span>{{ scope.row[firstProp] }}</span>
|
|
|
<!-- <span v-if="scope.row.reportType != 1">{{ scope.row.deptName }}</span> -->
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
@@ -70,6 +70,7 @@
|
|
|
import { selectNoVisitsInfo, getReportMaterialType, getReportMaterial } from '@/api/index';
|
|
|
import { mapState } from 'vuex';
|
|
|
export default {
|
|
|
+ name: 'hintDetail',
|
|
|
computed: {
|
|
|
...mapState({
|
|
|
userInfo: (state) => state.user.userInfo,
|
|
|
@@ -97,9 +98,10 @@ export default {
|
|
|
},
|
|
|
],
|
|
|
activePantoneTabName: '', //色卡tabName
|
|
|
- tabsItemPantone: [], //色卡tabItem
|
|
|
+ tabsItemPantone: {}, //色卡tabItem
|
|
|
toggleIndex: 0,
|
|
|
firstLabel: '',
|
|
|
+ firstProp: '',
|
|
|
tableColumn: [],
|
|
|
tableList: [],
|
|
|
// 未拜访
|
|
|
@@ -234,35 +236,52 @@ export default {
|
|
|
],
|
|
|
};
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ fromType: {
|
|
|
+ handler(newVal) {
|
|
|
+ this.tableColumn = this[newVal]; //表格头
|
|
|
+ this.activeTabName = newVal; // 当前激活tab
|
|
|
+ },
|
|
|
+ immediate: true,
|
|
|
+ },
|
|
|
+ },
|
|
|
activated() {
|
|
|
this.empLevel = this.userInfo.empLevel;
|
|
|
- this.firstLabel = this.empLevel == '1' ? '组织名称/大区主管' : '销售部主管';
|
|
|
+ this.firstLabel = this.empLevel == '1' ? '组织名称/大区主管' : '组织名称/销售部主管';
|
|
|
this.fromType = this.$route.query.fromType; // fromType: 'noVisit':未拜访; 'createStore':建店; 'pantone':色卡
|
|
|
- this.tableColumn = this[this.fromType]; //初始化表格头
|
|
|
- this.activeTabName = this.fromType;
|
|
|
+ // this.tableColumn = this[this.fromType]; //初始化表格头
|
|
|
+ // this.activeTabName = this.fromType;
|
|
|
this.deptId = this.userInfo.deptId; // 当前用户部门id
|
|
|
this.activaPantoneName = this.$route.query.pantoneName; //当前色卡
|
|
|
this.materialCode = this.$route.query.materialCode; // 色卡code
|
|
|
this.initData();
|
|
|
},
|
|
|
methods: {
|
|
|
- initData(resolve) {
|
|
|
+ initData(resolve, tree) {
|
|
|
if (this.fromType == 'noVisit') {
|
|
|
+ if (tree) this.deptId = tree.onlyId;
|
|
|
+ this.firstProp = 'onlyName';
|
|
|
this.selectNoVisitsInfoFun(resolve);
|
|
|
} else if (this.fromType == 'createStore') {
|
|
|
} else if (this.fromType == 'pantone') {
|
|
|
- this.getPantoneData();
|
|
|
+ this.firstProp = 'warehouseName';
|
|
|
+ let empLevel = tree ? tree.empLevel : null;
|
|
|
+ this.getPantoneData(resolve, empLevel);
|
|
|
}
|
|
|
},
|
|
|
tabChange(val) {
|
|
|
- setTimeout(() => {
|
|
|
- this.tableColumn = this[val];
|
|
|
- this.toggleIndex = this.toggleIndex++;
|
|
|
- }, 2000);
|
|
|
+ this.tableList = [];
|
|
|
+ // this.tableColumn = this[val];
|
|
|
+ this.fromType = val;
|
|
|
+ this.initData();
|
|
|
+ this.toggleIndex = this.toggleIndex++;
|
|
|
},
|
|
|
tabChangePantone(val) {
|
|
|
+ // this.fromType = val;
|
|
|
this.materialCode = this.tabsItemPantone[val].materialCode;
|
|
|
- this.getPantoneData();
|
|
|
+ this.tableList = [];
|
|
|
+ this.initData();
|
|
|
+ this.toggleIndex = this.toggleIndex++;
|
|
|
},
|
|
|
onClickLeft() {
|
|
|
this.$router.go(-1);
|
|
|
@@ -270,43 +289,15 @@ export default {
|
|
|
linKReportHistory(row, type) {},
|
|
|
// 加载子节点数据的函数
|
|
|
load(tree, treeNode, resolve) {
|
|
|
- // if (tree.reportType == 2) {
|
|
|
- // this.seacherFormload.parentId = tree.deptId;
|
|
|
- // } else if (tree.reportType == 3) {
|
|
|
- // // this.regionCode=tree.deptId
|
|
|
- // // this.regionName=tree.deptName+"销售大区"
|
|
|
- // this.seacherFormload.parentId = '';
|
|
|
- // this.seacherFormload.regionId = tree.deptId;
|
|
|
- // } else {
|
|
|
- // this.seacherFormload.parentId = '';
|
|
|
- // }
|
|
|
- this.deptId = tree.onlyId;
|
|
|
- this.initData(resolve);
|
|
|
- // request({
|
|
|
- // url: 'mobile/reportMobile/queryRates',
|
|
|
- // method: 'get',
|
|
|
- // params: this.seacherFormload,
|
|
|
- // }).then((res) => {
|
|
|
- // if (res.code == 200) {
|
|
|
- // for (var i = 0; i < res.data.length; i++) {
|
|
|
- // if (res.data[i].reportType > 1) {
|
|
|
- // res.data[i].hasChildren = true;
|
|
|
- // } else {
|
|
|
- // res.data[i].hasChildren = false;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // resolve(res.data);
|
|
|
- // } else {
|
|
|
- // this.$toast.fail('数据获取失败');
|
|
|
- // }
|
|
|
- // });
|
|
|
+ this.initData(resolve, tree);
|
|
|
},
|
|
|
// 未拜访
|
|
|
selectNoVisitsInfoFun(resolve) {
|
|
|
selectNoVisitsInfo({ deptId: this.deptId }).then((res) => {
|
|
|
res.data.forEach((val) => {
|
|
|
- val.hasChildren = true;
|
|
|
+ if (val.onLevel < 3) val.hasChildren = true;
|
|
|
});
|
|
|
+ // 是否是子级
|
|
|
if (resolve) {
|
|
|
resolve && resolve(res.data);
|
|
|
} else {
|
|
|
@@ -315,43 +306,30 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
// 色卡tab
|
|
|
- getPantoneData() {
|
|
|
- if (this.tabsItemPantone.length) {
|
|
|
- this.getReportMaterialTypeFun();
|
|
|
+ getPantoneData(resolve, empLevel) {
|
|
|
+ if (JSON.stringify(this.tabsItemPantone) != '{}') {
|
|
|
+ this.getReportMaterialTypeFun(resolve, empLevel);
|
|
|
} else {
|
|
|
getReportMaterial().then((res) => {
|
|
|
this.tabsItemPantone = res.data;
|
|
|
delete this.tabsItemPantone.tip;
|
|
|
- this.getReportMaterialTypeFun();
|
|
|
+ this.getReportMaterialTypeFun(null, null);
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
// 色卡详情
|
|
|
- getReportMaterialTypeFun() {
|
|
|
- getReportMaterialType({ materialCode: this.materialCode }).then((res) => {
|
|
|
- let resData = [
|
|
|
- {
|
|
|
- ...this.tabsItemPantone[this.activaPantoneName],
|
|
|
- children: res.data.colorCardList || [],
|
|
|
- },
|
|
|
- ];
|
|
|
- // [
|
|
|
- // {
|
|
|
- // id: 3,
|
|
|
- // date: '2016-05-01',
|
|
|
- // name: '王小虎',
|
|
|
- // address: '上海市普陀区金沙江路 1519 弄',
|
|
|
- // children: [
|
|
|
- // {
|
|
|
- // id: 32,
|
|
|
- // date: '2016-05-01',
|
|
|
- // name: '王小虎',
|
|
|
- // address: '上海市普陀区金沙江路 1519 弄',
|
|
|
- // },
|
|
|
- // ],
|
|
|
- // },
|
|
|
- // ],
|
|
|
- this.tableList = resData;
|
|
|
+ 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);
|
|
|
+ } else {
|
|
|
+ this.tableList = res.data.colorCardList;
|
|
|
+ }
|
|
|
});
|
|
|
},
|
|
|
},
|
|
|
@@ -381,6 +359,60 @@ export default {
|
|
|
.el-table__empty-block {
|
|
|
width: 99.9% !important;
|
|
|
}
|
|
|
+ .elTreeTable .el-table__cell:first-child .cell {
|
|
|
+ padding-left: 2px !important;
|
|
|
+ }
|
|
|
+
|
|
|
+ .elTreeTable .el-table__cell {
|
|
|
+ padding: 0px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .elTreeTable .el-table__body td.el-table__cell {
|
|
|
+ padding: 2px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .elTreeTable table col {
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+
|
|
|
+ .elTreeTable th.el-table__cell > .cell {
|
|
|
+ padding: 1px !important;
|
|
|
+ }
|
|
|
+
|
|
|
+ .elTreeTable {
|
|
|
+ font-size: 12px !important;
|
|
|
+ }
|
|
|
+
|
|
|
+ .elTreeTable th.el-table__cell {
|
|
|
+ padding: 1px !important;
|
|
|
+ }
|
|
|
+
|
|
|
+ .elTreeTable th.el-table__cell > .cell {
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+
|
|
|
+ .elTreeTable .el-table__header tr:first-child th.el-table__cell:first-child .cell {
|
|
|
+ /* width: 98px; */
|
|
|
+ }
|
|
|
+
|
|
|
+ .elTreeTable .linkSpan {
|
|
|
+ text-decoration: underline;
|
|
|
+ color: #0057ba;
|
|
|
+ display: block;
|
|
|
+ text-align: right;
|
|
|
+ padding: 6px 10px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .elTreeTable td.el-table__cell div {
|
|
|
+ padding: 0px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .elTreeTable .cell .spanNum {
|
|
|
+ display: block;
|
|
|
+ text-align: right;
|
|
|
+ padding: 6px 10px;
|
|
|
+ }
|
|
|
+
|
|
|
.elTreeTable .el-table__expand-icon {
|
|
|
float: right;
|
|
|
}
|