Commit 127904c7 authored by tyn's avatar tyn

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

parent 31d77f68
<template> <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"> :style="maxBodyFixedStyle">
<div class="table-item"> <div class="table-item">
<el-table v-if="tableDataTotal>0" class="custom-table" v-loading="tableLoading" :data="tableData" element-loading-text="Loading" <el-table v-if="tableDataTotal>0" class="custom-table" v-loading="tableLoading" :data="tableData" element-loading-text="Loading"
...@@ -144,6 +145,7 @@ export default { ...@@ -144,6 +145,7 @@ export default {
hasQueryParams: false, hasQueryParams: false,
comMaxBodyHeight: 0, comMaxBodyHeight: 0,
headerLastBlockHeight: 0, headerLastBlockHeight: 0,
hasYScroll: false,
observer: null, observer: null,
resizeTimer: null resizeTimer: null
}; };
...@@ -208,6 +210,7 @@ export default { ...@@ -208,6 +210,7 @@ export default {
const isFixedNumber = typeof this.maxHeight == "number"; const isFixedNumber = typeof this.maxHeight == "number";
// 最大高度 // 最大高度
let containerMaxHeight = null; let containerMaxHeight = null;
// 是固定数值
if (isFixedNumber && !resize) { if (isFixedNumber && !resize) {
containerMaxHeight = this.maxHeight; containerMaxHeight = this.maxHeight;
} else { } else {
...@@ -222,7 +225,7 @@ export default { ...@@ -222,7 +225,7 @@ export default {
} }
// 列表自适应高度 // 列表自适应高度
this.comMaxHeight = containerMaxHeight ? `${containerMaxHeight}px` : null; this.comMaxHeight = containerMaxHeight ? `${containerMaxHeight}px` : null;
// 重新计算表格高度 减去滚动条高度差 16 - 6 // 重新计算表格高度 减去滚动条高度差 16 - 6 有固定列的情况
if (containerMaxHeight) { if (containerMaxHeight) {
/** /**
* @type {HTMLDivElement} * @type {HTMLDivElement}
...@@ -234,6 +237,15 @@ export default { ...@@ -234,6 +237,15 @@ export default {
const bodyMaxHeight = containerMaxHeight - headerHeight - 16; const bodyMaxHeight = containerMaxHeight - headerHeight - 16;
// console.log(bodyMaxHeight, "bodyMaxHeight"); // console.log(bodyMaxHeight, "bodyMaxHeight");
this.comMaxBodyHeight = 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 { } else {
// 没有固定列 正常情况下 计算默认header高度 // 没有固定列 正常情况下 计算默认header高度
const defaultHeader = this.$el.querySelector(".el-table__header-wrapper"); const defaultHeader = this.$el.querySelector(".el-table__header-wrapper");
...@@ -306,14 +318,14 @@ export default { ...@@ -306,14 +318,14 @@ export default {
/* 右侧fixed列 */ /* 右侧fixed列 */
.el-table__fixed-right { .el-table__fixed-right {
z-index: 9; z-index: 9;
right: 16px !important; right: 0px !important;
bottom: 15px !important; bottom: 15px !important;
.el-table__fixed-header-wrapper { .el-table__fixed-header-wrapper {
position: absolute; position: absolute;
} }
} }
.el-table__fixed-right-patch { .el-table__fixed-right-patch {
width: 16px !important; width: 0px !important;
z-index: 9; z-index: 9;
top: 0px; top: 0px;
background: #f0f3fa; background: #f0f3fa;
...@@ -335,6 +347,21 @@ export default { ...@@ -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 { ...@@ -208,7 +208,6 @@ export default {
this.menuDetails=_tempArray this.menuDetails=_tempArray
this.menuTreeList.push(_tempArray); this.menuTreeList.push(_tempArray);
const defaultCurrent = this.findMenuNode(this.menuTreeList, "宝安中学(集团)初中部改扩建工程施工总承包-加固修缮工程"); const defaultCurrent = this.findMenuNode(this.menuTreeList, "宝安中学(集团)初中部改扩建工程施工总承包-加固修缮工程");
console.log(defaultCurrent,"defaultCurrent");
if (defaultCurrent) { if (defaultCurrent) {
this.defaultActive = defaultCurrent.menuId; this.defaultActive = defaultCurrent.menuId;
this.menuId = defaultCurrent.menuId; this.menuId = defaultCurrent.menuId;
...@@ -291,9 +290,8 @@ export default { ...@@ -291,9 +290,8 @@ export default {
}); });
}, },
findMenuNode(tree, nodeName) { findMenuNode(tree, nodeName) {
// console.log(tree)
for (const item of 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) { if (item.childrenList instanceof Array) {
const result = this.findMenuNode(item.childrenList, nodeName); const result = this.findMenuNode(item.childrenList, nodeName);
if (result) return result; if (result) return result;
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
:cell-class-name="cellClassName"> :cell-class-name="cellClassName">
<template slot="action-field-bar" slot-scope="scope"> <template slot="action-field-bar" slot-scope="scope">
<div class="project-action-field-bar" v-if="rowCanEditInput(scope.rowIndex,hasTarget)"> <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> @click="parseFloat(scope.row.quantities) ? pushProjectUse(scope.row) : ''">推送工程量</span>
</div> </div>
<span v-else>-</span> <span v-else>-</span>
...@@ -590,7 +590,7 @@ export default { ...@@ -590,7 +590,7 @@ export default {
this.clearStatisticsTimer(); this.clearStatisticsTimer();
// 填写一秒后触发 // 填写一秒后触发
this.statisticsTimer = setTimeout(() => { 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); this.$set(this.dataForm.tableDataList[0], prop, sum);
}, 500); }, 500);
...@@ -605,11 +605,16 @@ export default { ...@@ -605,11 +605,16 @@ export default {
}, 0); }, 0);
return sum; return sum;
}, },
// 当前是否可编辑 // 当前是否可编辑
rowCanEditInput(index, hasTarget) { rowCanEditInput(index, hasTarget) {
// 不为id 0 或 不是劳务分包跟专业分包 // 不为id 0 或 不是劳务分包跟专业分包
return index != 0 || !hasTarget; return index != 0 || !hasTarget;
}, },
// 当前行源数据是否存在以推送工程量
rowHasLastPush(index) {
const _tempRow = this.originTableDataList[index];
return !parseFloat(_tempRow.quantities)
},
// 保存 // 保存
saveActualCost() { saveActualCost() {
this.$refs["feedSummaryForm"].validate(async flag => { this.$refs["feedSummaryForm"].validate(async flag => {
......
...@@ -105,6 +105,19 @@ export default { ...@@ -105,6 +105,19 @@ export default {
}, },
//方法集 //方法集
methods: { 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() { getResultMenuList() {
return this.tempMenuTree; return this.tempMenuTree;
...@@ -271,10 +284,9 @@ export default { ...@@ -271,10 +284,9 @@ export default {
/* 重置一级二级菜单 高度行高 */ /* 重置一级二级菜单 高度行高 */
.project-menu-item-container { .project-menu-item-container {
/* 有下级菜单 */ /* 有下级菜单 */
.project-sub-menu-item { .project-sub-menu-item {
&>.el-submenu__title { & > .el-submenu__title {
height: 32px; height: 32px;
line-height: unset; line-height: unset;
display: flex; display: flex;
...@@ -298,7 +310,7 @@ export default { ...@@ -298,7 +310,7 @@ export default {
text-overflow: ellipsis; text-overflow: ellipsis;
} }
&>img { & > img {
width: 16px; width: 16px;
height: 16px; height: 16px;
margin-right: 4px; margin-right: 4px;
...@@ -316,9 +328,11 @@ export default { ...@@ -316,9 +328,11 @@ export default {
&:hover { &:hover {
background-color: unset; background-color: unset;
background: linear-gradient(91deg, background: linear-gradient(
rgba(0, 129, 255, 0.1) 0%, 91deg,
rgba(0, 129, 255, 0) 100%); rgba(0, 129, 255, 0.1) 0%,
rgba(0, 129, 255, 0) 100%
);
} }
} }
} }
...@@ -344,9 +358,11 @@ export default { ...@@ -344,9 +358,11 @@ export default {
&.is-active { &.is-active {
.project-only-menu-title-container { .project-only-menu-title-container {
background-color: unset; background-color: unset;
background: linear-gradient(91deg, background: linear-gradient(
rgba(0, 129, 255, 0.1) 0%, 91deg,
rgba(0, 129, 255, 0) 100%); rgba(0, 129, 255, 0.1) 0%,
rgba(0, 129, 255, 0) 100%
);
.project-only-menu-title { .project-only-menu-title {
color: #0081ff; color: #0081ff;
...@@ -372,9 +388,11 @@ export default { ...@@ -372,9 +388,11 @@ export default {
&:hover { &:hover {
background-color: unset; background-color: unset;
background: linear-gradient(91deg, background: linear-gradient(
rgba(0, 129, 255, 0.1) 0%, 91deg,
rgba(0, 129, 255, 0) 100%); rgba(0, 129, 255, 0.1) 0%,
rgba(0, 129, 255, 0) 100%
);
} }
.project-only-menu-title { .project-only-menu-title {
...@@ -393,7 +411,7 @@ export default { ...@@ -393,7 +411,7 @@ export default {
text-overflow: ellipsis; text-overflow: ellipsis;
} }
&>img { & > img {
width: 16px; width: 16px;
height: 16px; height: 16px;
margin-right: 4px; 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