Commit 6ab2fc68 authored by tianhongyang's avatar tianhongyang

fix merge

parent 866c1b33
module.exports = {
presets: [
// https://github.com/vuejs/vue-cli/tree/master/packages/@vue/babel-preset-app
[
'@vue/cli-plugin-babel/preset',
{
useBuiltIns: "entry",
},
],
['@vue/babel-preset-jsx', { 'injectH': false }]
],
'env': {
......
......@@ -240,6 +240,17 @@ export const getFeedSummaryListApi = (params = {}) => request({
params
});
/**
* 更新月成本信息
* @param {*} data
* @returns
*/
export const updateFeedSummaryRowsApi = (data) => request({
url: "/cb/quantity/summary/updateActual",
method: "put",
data
});
//工程项目信息
......
......@@ -45,6 +45,7 @@
<script>
import NoData from '@/components/NoData';
import TableListColumn from "@/components/TableListCom/components/TableListColumn";
import { generateRandomLowerCaseLetter } from "@/utils";
export default {
name: "tableListCom",
props: {
......@@ -140,7 +141,9 @@ export default {
show_page: this.paging,
comMaxHeight: null,
hasQueryParams: false,
comMaxBodyHeight: 0
comMaxBodyHeight: 0,
observer: null,
resizeTimer: null
};
},
watch: {
......@@ -170,24 +173,50 @@ export default {
},
created() {
this.maxHeight ? this.maxHeightInit() : null;
// 创建dom元素 监听器 ,容器出现变化 重新获取元素参数
this.createResizeObserver();
},
beforeDestroy() {
this.clearResizeTimer();
if (this.observer) {
this.observer.disconnect();
}
},
methods: {
async createResizeObserver() {
this.observer = new ResizeObserver(entries => {
this.clearResizeTimer();
this.resizeTimer = setTimeout(() => {
this.maxHeightInit(true);
}, 1000);
});
await this.$nextTick();
this.observer.observe(this.$el);
},
clearResizeTimer() {
clearTimeout(this.resizeTimer);
this.resizeTimer = null;
},
// 自适应当前容器
async maxHeightInit() {
async maxHeightInit(resize = false) {
try {
await this.$nextTick();
// 固定数值
const isFixedNumber = typeof this.maxHeight == "number";
// 最大高度
let containerMaxHeight = null;
if (isFixedNumber) {
if (isFixedNumber && !resize) {
containerMaxHeight = this.maxHeight;
} else {
/**
* @type {HTMLDivElement}
*/
const container = this.$el.querySelector(".table-item");
const container = this.$el;
if (container) {
// console.log(container.offsetHeight, "container.offsetHeight");
// 拿到可用视口高度
console.log(container.offsetHeight);
console.log(container.getBoundingClientRect());
containerMaxHeight = container.offsetHeight;
}
}
......@@ -203,6 +232,7 @@ export default {
const headerHeight = parseInt(window.getComputedStyle(tableRightHeader).height);
//原滚动条高度为6px 差 10px
const bodyMaxHeight = containerMaxHeight - headerHeight - 16;
// console.log(bodyMaxHeight, "bodyMaxHeight");
this.comMaxBodyHeight = bodyMaxHeight;
}
}
......@@ -262,6 +292,7 @@ export default {
/* maxHeight自适应样式 */
&.auto-max-height {
height: 100%;
::v-deep .table-item {
// 原滚动条为6px 现在多10px
.el-table {
......
......@@ -35,8 +35,9 @@
<!-- 数据列表部分 -->
<div class="project-feedsummary-list-container">
<dsk-skeleton v-if="tableLoading"></dsk-skeleton>
<custom-table :tableData="tableDataList" :formColum="formColum" v-else-if="!tableLoading" :max-height="true" :tableDataTotal="total"
:paging="false">
<el-form :model="dataForm" ref="feedSummaryForm" :show-message="false" v-else-if="!tableLoading" class="feed-summary-form">
<custom-table :tableData="dataForm.tableDataList" :formColum="formColum" :max-height="true" :tableDataTotal="total" :paging="false"
:cell-class-name="cellClassName">
<template slot="action-field-bar" slot-scope="scope">
<div class="project-action-field-bar" v-if="scope.row.id != '0'">
<span class="push-project">推送工程量</span>
......@@ -44,6 +45,7 @@
<span v-else>-</span>
</template>
</custom-table>
</el-form>
</div>
</div>
</div>
......@@ -55,7 +57,7 @@
</template>
<script>
import ProjectSideMenu from "@/views/projectCostLedger/detail/components/ProjectSideMenu";
import { getFeedSummaryMenuTreeApi, getFeedSummaryMonthListApi, getFeedSummaryListApi } from "@/api/projectCostLedger";
import { getFeedSummaryMenuTreeApi, getFeedSummaryMonthListApi, getFeedSummaryListApi, updateFeedSummaryRowsApi } from "@/api/projectCostLedger";
import DskTableHeaderSetting from "@/components/DskTableHeaderSetting";
import DskSkeleton from "@/components/DskSkeleton";
import CustomTable from "@/components/CustomTable";
......@@ -78,6 +80,14 @@ const statisticsPropNames = [
"purchaseUnitPrice"
];
// 可编辑字段
const editPropNames = [
"quantities",
"totalQuantities",
"purchaseUnitPrice",
"createTime"
];
export default {
name: "feedSummary",
props: {
......@@ -174,7 +184,11 @@ export default {
// 当前选中的成本科目
currentNodeName: "",
// 数据列表
originTableDataList: [],
dataForm: {
// 数据列表源数据
tableDataList: [],
},
statisticsParentName: ["劳务分包工程", "专业分包工程"],
// 填写实际成本弹窗
showAddActualCost: false,
......@@ -271,7 +285,8 @@ export default {
const row = this.countRowParams(_temp, statisticsPropNames);
_temp.unshift(row);
}
this.tableDataList = _temp;
this.$set(this.dataForm, "tableDataList", cloneDeep(_temp));
this.originTableDataList = cloneDeep(_temp);
this.total = _temp.length;
}
} catch (error) {
......@@ -376,14 +391,14 @@ export default {
// 获取列表数据
this.getFeedSummaryList(params);
},
menuSelect(currentId, currentTemp) {
async menuSelect(currentId, currentTemp) {
this.resetEditStatus();
this.currentNodeName = currentId;
const parentName = currentTemp.parent ? this.getCurrentType(currentTemp.parent) : currentId;
if (parentName) this.currentParentName = parentName;
// 请求数据列表
const params = this.createRequestConditions();
this.getFeedSummaryList(params);
await this.getFeedSummaryList(params);
},
getCurrentType(parent) {
if (parent.level == 2) {
......@@ -449,6 +464,33 @@ export default {
params["recordDate"] = selectTime;
// 获取选中月数据
await this.getFeedSummaryList(params);
// 将编辑区域移动到视口
await this.editRegionToViewPort();
},
async editRegionToViewPort() {
await this.$nextTick();
// 获取编辑列所处位置
const container = document.querySelector(".el-table__body-wrapper");
/**
* @type {HTMLTableCellElement}
*/
const editElement = container.querySelector(".el-table__row [class *= can-edit-column-]");
if (editElement) {
const left = editElement.offsetLeft;
container.scrollTo({
behavior: "smooth",
left,
top: 0
});
}
},
cellClassName({ row, column, rowIndex, columnIndex }) {
// console.log(column);
const { property } = column;
if (editPropNames.includes(property)) {
return `can-edit-column-${property}`;
}
return "";
}
},
}
......@@ -533,17 +575,21 @@ export default {
}
.project-feedsummary-list-container {
position: relative;
width: 100%;
height: calc(100% - 48px);
overflow: auto;
.feed-summary-form {
height: 100%;
}
.dsk-skeleton-outer-container {
padding: 0px;
height: 100%;
}
::v-deep .table-list-com-ins {
height: 100%;
.table-item {
.el-table {
th {
......
......@@ -193,8 +193,8 @@ export default {
const detail = await getProjectDetailApi(projectId);
if (detail.code == 200 && detail.data) {
if (detail.data.id) detail.data["projectId"] = detail.data.id;
// detail.data["projectId"] = "1754425038355890177";
// detail.data["cbStage"] = 0;
detail.data["projectId"] = "1754425038355890177";
detail.data["cbStage"] = 0;
this.detailInfo = detail.data;
}
} catch (error) {
......
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