Commit 127904c7 authored by tyn's avatar tyn

🎈 perf(优化项目详情菜单首次命中;工料汇总可推送判断更正;工料汇总样式显示错误更正;

parent 31d77f68
<template>
<div class="table-list-com-ins" :class="{'is-empty-table' : !tableDataTotal,'no-pagination' : !hasQueryParams,'auto-max-height' : maxHeight}"
<div class="table-list-com-ins"
:class="{'is-empty-table' : !tableDataTotal,'no-pagination' : !hasQueryParams,'auto-max-height' : maxHeight,'has-y-Scroll' : maxHeight && hasYScroll}"
:style="maxBodyFixedStyle">
<div class="table-item">
<el-table v-if="tableDataTotal>0" class="custom-table" v-loading="tableLoading" :data="tableData" element-loading-text="Loading"
......@@ -144,6 +145,7 @@ export default {
hasQueryParams: false,
comMaxBodyHeight: 0,
headerLastBlockHeight: 0,
hasYScroll: false,
observer: null,
resizeTimer: null
};
......@@ -208,6 +210,7 @@ export default {
const isFixedNumber = typeof this.maxHeight == "number";
// 最大高度
let containerMaxHeight = null;
// 是固定数值
if (isFixedNumber && !resize) {
containerMaxHeight = this.maxHeight;
} else {
......@@ -222,7 +225,7 @@ export default {
}
// 列表自适应高度
this.comMaxHeight = containerMaxHeight ? `${containerMaxHeight}px` : null;
// 重新计算表格高度 减去滚动条高度差 16 - 6
// 重新计算表格高度 减去滚动条高度差 16 - 6 有固定列的情况
if (containerMaxHeight) {
/**
* @type {HTMLDivElement}
......@@ -234,6 +237,15 @@ export default {
const bodyMaxHeight = containerMaxHeight - headerHeight - 16;
// console.log(bodyMaxHeight, "bodyMaxHeight");
this.comMaxBodyHeight = bodyMaxHeight;
// 表体 判断是否有竖向滚动条 容器 bodyMaxHeight 整体 最大高度大于 内部列表高度 则没有滚动条
const fixedTableBody = this.$el.querySelector(".el-table__fixed-body-wrapper");
// dom更新后 重新比较 高度
await this.$nextTick();
// 拿到 固定列表体实际高度 包含滚动高度
const fixedBodyHeight = fixedTableBody.scrollHeight;
// console.log(bodyMaxHeight,"bodyMaxHeight");
// console.log(parseFloat(fixedBodyHeight),"fixedBodyHeight");
this.hasYScroll = bodyMaxHeight >= parseFloat(fixedBodyHeight) ? false : true;
} else {
// 没有固定列 正常情况下 计算默认header高度
const defaultHeader = this.$el.querySelector(".el-table__header-wrapper");
......@@ -306,14 +318,14 @@ export default {
/* 右侧fixed列 */
.el-table__fixed-right {
z-index: 9;
right: 16px !important;
right: 0px !important;
bottom: 15px !important;
.el-table__fixed-header-wrapper {
position: absolute;
}
}
.el-table__fixed-right-patch {
width: 16px !important;
width: 0px !important;
z-index: 9;
top: 0px;
background: #f0f3fa;
......@@ -335,6 +347,21 @@ export default {
}
}
}
// 是否存在Y轴滚动条
&.has-y-Scroll {
::v-deep .table-item {
.el-table {
/* 右侧fixed列 */
.el-table__fixed-right {
right: 16px !important;
}
.el-table__fixed-right-patch {
width: 16px !important;
}
}
}
}
}
/* 不需要分页 或没有分页参数 */
......
......@@ -208,7 +208,6 @@ export default {
this.menuDetails=_tempArray
this.menuTreeList.push(_tempArray);
const defaultCurrent = this.findMenuNode(this.menuTreeList, "宝安中学(集团)初中部改扩建工程施工总承包-加固修缮工程");
console.log(defaultCurrent,"defaultCurrent");
if (defaultCurrent) {
this.defaultActive = defaultCurrent.menuId;
this.menuId = defaultCurrent.menuId;
......@@ -291,9 +290,8 @@ export default {
});
},
findMenuNode(tree, nodeName) {
// console.log(tree)
for (const item of tree) {
if (item.menuName == nodeName) return item;
if (item.menuName == nodeName && !item?.childrenList?.length) return item;
if (item.childrenList instanceof Array) {
const result = this.findMenuNode(item.childrenList, nodeName);
if (result) return result;
......
......@@ -41,7 +41,7 @@
:cell-class-name="cellClassName">
<template slot="action-field-bar" slot-scope="scope">
<div class="project-action-field-bar" v-if="rowCanEditInput(scope.rowIndex,hasTarget)">
<span class="push-project-use" :class="{'is-emty-quantities' : !parseFloat(scope.row.quantities)}"
<span class="push-project-use" :class="{'is-emty-quantities' : rowHasLastPush(scope.rowIndex)}"
@click="parseFloat(scope.row.quantities) ? pushProjectUse(scope.row) : ''">推送工程量</span>
</div>
<span v-else>-</span>
......@@ -590,7 +590,7 @@ export default {
this.clearStatisticsTimer();
// 填写一秒后触发
this.statisticsTimer = setTimeout(() => {
const sum = this.sumHandler(this.dataForm.tableDataList, prop, true);
const sum = this.sumHandler(this.dataForm.tableDataList, prop, this.hasTarget);
// 更新统计值
this.$set(this.dataForm.tableDataList[0], prop, sum);
}, 500);
......@@ -605,11 +605,16 @@ export default {
}, 0);
return sum;
},
// 当前是否可编辑
// 当前是否可编辑
rowCanEditInput(index, hasTarget) {
// 不为id 0 或 不是劳务分包跟专业分包
return index != 0 || !hasTarget;
},
// 当前行源数据是否存在以推送工程量
rowHasLastPush(index) {
const _tempRow = this.originTableDataList[index];
return !parseFloat(_tempRow.quantities)
},
// 保存
saveActualCost() {
this.$refs["feedSummaryForm"].validate(async flag => {
......
......@@ -105,6 +105,19 @@ export default {
},
//方法集
methods: {
// 获取第一层最深层的id
getFirstLevelWithDeepId() {
function getCurrentId(array) {
const len = array.length;
for (let index = 0; index < len; index++) {
if (index > 0) break;
const item = array[index];
if (!item?.children) return item.nodeValue;
return getCurrentId(item.children);
}
}
return getCurrentId(this.tempMenuTree);
},
// 获取最终菜单结构
getResultMenuList() {
return this.tempMenuTree;
......@@ -271,10 +284,9 @@ export default {
/* 重置一级二级菜单 高度行高 */
.project-menu-item-container {
/* 有下级菜单 */
.project-sub-menu-item {
&>.el-submenu__title {
& > .el-submenu__title {
height: 32px;
line-height: unset;
display: flex;
......@@ -298,7 +310,7 @@ export default {
text-overflow: ellipsis;
}
&>img {
& > img {
width: 16px;
height: 16px;
margin-right: 4px;
......@@ -316,9 +328,11 @@ export default {
&:hover {
background-color: unset;
background: linear-gradient(91deg,
background: linear-gradient(
91deg,
rgba(0, 129, 255, 0.1) 0%,
rgba(0, 129, 255, 0) 100%);
rgba(0, 129, 255, 0) 100%
);
}
}
}
......@@ -344,9 +358,11 @@ export default {
&.is-active {
.project-only-menu-title-container {
background-color: unset;
background: linear-gradient(91deg,
background: linear-gradient(
91deg,
rgba(0, 129, 255, 0.1) 0%,
rgba(0, 129, 255, 0) 100%);
rgba(0, 129, 255, 0) 100%
);
.project-only-menu-title {
color: #0081ff;
......@@ -372,9 +388,11 @@ export default {
&:hover {
background-color: unset;
background: linear-gradient(91deg,
background: linear-gradient(
91deg,
rgba(0, 129, 255, 0.1) 0%,
rgba(0, 129, 255, 0) 100%);
rgba(0, 129, 255, 0) 100%
);
}
.project-only-menu-title {
......@@ -393,7 +411,7 @@ export default {
text-overflow: ellipsis;
}
&>img {
& > img {
width: 16px;
height: 16px;
margin-right: 4px;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment