Commit 0e22c1f5 authored by huangjie's avatar huangjie

Merge branch 'V20231129-中建一局二公司' of http://192.168.60.201/root/dsk-operate-sys...

Merge branch 'V20231129-中建一局二公司' of http://192.168.60.201/root/dsk-operate-sys into V20231129-中建一局二公司
parents 67e9202b 792aba24
...@@ -2,17 +2,12 @@ ...@@ -2,17 +2,12 @@
<div class="custom-table-list-com-ins" <div class="custom-table-list-com-ins"
:class="{'is-empty-table' : !tableDataTotal,'no-pagination' : !hasQueryParams,'auto-max-height' : maxHeight,'has-y-Scroll' : maxHeight && hasYScroll}" :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="custom-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="comTableLoading" :data="tableData" element-loading-text="加载中"
ref="customTableRef" border fit highlight-current-row :default-sort="defaultSort?defaultSort:{}" @sort-change="sortChange" ref="customTableRef" border fit highlight-current-row :default-sort="defaultSort?defaultSort:{}" @sort-change="sortChange"
@selection-change="selectionChange" :cell-class-name="cellClassName" :cell-style="cellStyle" :row-class-name="rowClassName" @selection-change="selectionChange" @expand-change="expandChange" :cell-class-name="cellClassName" :cell-style="cellStyle"
:row-style="rowStyle" :height="height" :maxHeight="comMaxHeight" v-sticky-header="stickyHeader"> :row-class-name="rowClassName" :row-style="rowStyle" :row-key="rowKey" :lazy="lazy" :load="loadFn" :tree-props="treeOptions"
<el-table-column type="selection" :width="needSelection.width ? needSelection.width : '38px'" v-if="needSelection.flag" :default-expand-all="defaultExpandAll" :indent="indent" :height="height" :maxHeight="comMaxHeight" v-sticky-header="stickyHeader">
:fixed="needSelection.fixed" :align="needSelection.align" :show-overflow-tooltip="needSelection.showOverflowTooltip">
</el-table-column>
<el-table-column type="index" v-if="isIndex" label="序号" :width="flexWidth(tableData)" align="left" :fixed="indexFixed" :resizable="false">
<template slot-scope="scope">{{pagingHandler(hasQueryParams,queryParams,scope)}}</template>
</el-table-column>
<!-- 列二次封装 --> <!-- 列二次封装 -->
<template v-for="(item,index) of formColum"> <template v-for="(item,index) of formColum">
...@@ -57,20 +52,6 @@ export default { ...@@ -57,20 +52,6 @@ export default {
maxHeight: { maxHeight: {
type: [Boolean, Number] type: [Boolean, Number]
}, },
isIndex: {
type: Boolean,
default: false
},
needSelection: {
type: Object,
default: () => ({
flag: false,
width: "39px",
fixed: false,
align: "left",
showOverflowTooltip: false
})
},
cellClassName: { cellClassName: {
type: Function, type: Function,
default: () => { } default: () => { }
...@@ -87,6 +68,39 @@ export default { ...@@ -87,6 +68,39 @@ export default {
type: Function, type: Function,
default: () => { } default: () => { }
}, },
rowKey: {
type: [String, Number],
default: "id"
},
// 是否树形结构懒加载
lazy: {
type: Boolean,
default: false
},
// 懒加载函数
loadFn: {
type: Function,
default: () => { }
},
// 懒加载配置字段映射
treeOptions: {
type: Object,
default: () => ({})
},
// 树形结构默认展开行
defaultExpandAll: {
type: Boolean,
default: false
},
// 树形结构展示事件
expandChange: {
type: Function,
default: () => { }
},
indent: {
type: Number,
default: 16
},
// 吸顶偏移量 // 吸顶偏移量
stickyHeader: { stickyHeader: {
type: Object, type: Object,
...@@ -147,7 +161,8 @@ export default { ...@@ -147,7 +161,8 @@ export default {
headerLastBlockHeight: 0, headerLastBlockHeight: 0,
hasYScroll: false, hasYScroll: false,
observer: null, observer: null,
resizeTimer: null resizeTimer: null,
comTableLoading: this.tableLoading
}; };
}, },
watch: { watch: {
...@@ -166,6 +181,11 @@ export default { ...@@ -166,6 +181,11 @@ export default {
}, },
immediate: true, immediate: true,
deep: true deep: true
},
tableLoading: {
handler(newValue) {
this.comTableLoading = newValue;
}
} }
}, },
computed: { computed: {
...@@ -303,7 +323,7 @@ export default { ...@@ -303,7 +323,7 @@ export default {
.custom-table-list-com-ins { .custom-table-list-com-ins {
/* 空数据样式 */ /* 空数据样式 */
&.is-empty-table { &.is-empty-table {
.table-item { .custom-table-item {
max-height: unset; max-height: unset;
height: 100%; height: 100%;
} }
...@@ -312,7 +332,7 @@ export default { ...@@ -312,7 +332,7 @@ export default {
/* maxHeight自适应样式 */ /* maxHeight自适应样式 */
&.auto-max-height { &.auto-max-height {
height: 100%; height: 100%;
::v-deep .table-item { ::v-deep .custom-table-item {
// 原滚动条为6px 现在多10px // 原滚动条为6px 现在多10px
.el-table { .el-table {
/* 右侧fixed列 */ /* 右侧fixed列 */
...@@ -350,7 +370,7 @@ export default { ...@@ -350,7 +370,7 @@ export default {
// 是否存在Y轴滚动条 // 是否存在Y轴滚动条
&.has-y-Scroll { &.has-y-Scroll {
::v-deep .table-item { ::v-deep .custom-table-item {
.el-table { .el-table {
/* 右侧fixed列 */ /* 右侧fixed列 */
.el-table__fixed-right { .el-table__fixed-right {
...@@ -366,12 +386,12 @@ export default { ...@@ -366,12 +386,12 @@ export default {
/* 不需要分页 或没有分页参数 */ /* 不需要分页 或没有分页参数 */
&.no-pagination { &.no-pagination {
::v-deep .table-item { ::v-deep .custom-table-item {
max-height: 100%; max-height: 100%;
} }
} }
::v-deep .table-item { ::v-deep .custom-table-item {
width: 100%; width: 100%;
max-height: calc(100% - 40px); max-height: calc(100% - 40px);
......
...@@ -72,5 +72,19 @@ export default { ...@@ -72,5 +72,19 @@ export default {
height: calc(100%); height: calc(100%);
} }
} }
.title_wrap{
padding: 20px;
background-color: #FFFFFF;
border-bottom: 1px solid #e0e0e0;
}
.enterprise_title{
border-left: 2px solid #445781;
padding-left: 8px;
font-size: 16px;
height: 16px;
line-height: 16px;
font-weight: 700;
color: #232323;
}
} }
</style> </style>
...@@ -67,5 +67,19 @@ export default { ...@@ -67,5 +67,19 @@ export default {
height: calc(100%); height: calc(100%);
} }
} }
.title_wrap{
padding: 20px;
background-color: #FFFFFF;
border-bottom: 1px solid #e0e0e0;
}
.enterprise_title{
border-left: 2px solid #445781;
padding-left: 8px;
font-size: 16px;
height: 16px;
line-height: 16px;
font-weight: 700;
color: #232323;
}
} }
</style> </style>
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<div class="right-table-list-container"> <div class="right-table-list-container">
<div class="project-table-list-header"> <div class="project-table-list-header">
<div class="project-table-list-haeder-left"> <div class="project-table-list-haeder-left">
<el-select v-model="recordDate" placeholder="请选择年月" class="project-month-select-options" clearable @change="monthChange"> <el-select v-model="expenseDate" placeholder="请选择年月" class="project-month-select-options" clearable @change="monthChange">
<el-option v-for="item in monthList" :key="item.expenseDate" :label="item.label" :value="item.expenseDate"> <el-option v-for="item in monthList" :key="item.expenseDate" :label="item.label" :value="item.expenseDate">
</el-option> </el-option>
</el-select> </el-select>
...@@ -33,10 +33,10 @@ ...@@ -33,10 +33,10 @@
<!-- 数据列表部分 --> <!-- 数据列表部分 -->
<div class="project-feedsummary-list-container"> <div class="project-feedsummary-list-container">
<dsk-skeleton v-if="tableLoading"></dsk-skeleton> <dsk-skeleton v-if="tableLoading"></dsk-skeleton>
<!-- 非实体工程材料列表 --> <el-form :model="dataForm" ref="costSummaryForm" :show-message="false" v-else-if="!tableLoading" class="feed-summary-form">
<el-form :model="dataForm" ref="feedSummaryForm" :show-message="false" v-else-if="!tableLoading" class="feed-summary-form"> <custom-table ref="costSummaryTable" :tableData="dataForm.tableDataList" :formColum="formColum" :max-height="true" :row-key="rowKey"
<custom-table :tableData="dataForm.tableDataList" :formColum="formColum" :max-height="true" :tableDataTotal="total" :paging="false" :lazy="true" :load-fn="tableLazyLoad" :tree-options="treeOptions" :default-expand-all="false" :indent="8" :tableDataTotal="total"
:cell-class-name="cellClassName"> :paging="false" :cell-class-name="cellClassName">
</custom-table> </custom-table>
</el-form> </el-form>
</div> </div>
...@@ -53,6 +53,13 @@ import { v4 } from 'uuid'; ...@@ -53,6 +53,13 @@ import { v4 } from 'uuid';
import dayjs from "dayjs"; import dayjs from "dayjs";
import { cloneDeep } from "lodash-es"; import { cloneDeep } from "lodash-es";
import { add } from "@/utils/decimal"; import { add } from "@/utils/decimal";
// 可编辑字段
const editPropNames = [
"taxInclusiveExpense",
"taxExclusiveExpense",
];
export default { export default {
name: "costSummary", name: "costSummary",
props: { props: {
...@@ -81,9 +88,9 @@ export default { ...@@ -81,9 +88,9 @@ export default {
this.comProjectId = newValue; this.comProjectId = newValue;
} }
}, },
recordDate: { expenseDate: {
handler(newValue, oldValue) { handler(newValue, oldValue) {
this.oldRecordDate = newValue; this.oldExpenseDate = newValue;
} }
} }
}, },
...@@ -118,10 +125,16 @@ export default { ...@@ -118,10 +125,16 @@ export default {
total: 0, total: 0,
// 列表表头 // 列表表头
formColum: [ formColum: [
// { label: '序号', prop: "staticSerialNumber", type: "index", lock: true, width: "53", fixed: false, uid: v4() }, { label: '序号', prop: "number", minWidth: "53", uid: v4() },
// { label: '操作', prop: "action-field-bar", width: "99", uid: v4(), fixed: "right" }, { label: '名称', prop: "cbName", width: "303", uid: v4(), showOverflowTooltip: true },
], ],
monthList: [], monthList: [],
rowKey: "id",
// 列表懒加载配置
treeOptions: {
children: "children",
hasChildren: "hasChildren"
},
// 源数据月份 // 源数据月份
originMonthList: [], originMonthList: [],
dataForm: { dataForm: {
...@@ -129,9 +142,9 @@ export default { ...@@ -129,9 +142,9 @@ export default {
tableDataList: [], tableDataList: [],
}, },
// 当前查询的数据月份 // 当前查询的数据月份
recordDate: "", expenseDate: "",
// 历史查询月份 // 历史查询月份
oldRecordDate: "", oldExpenseDate: "",
// 当前选中子菜单的父类名称 // 当前选中子菜单的父类名称
currentParentName: "", currentParentName: "",
// 当前选中的成本科目 // 当前选中的成本科目
...@@ -158,9 +171,13 @@ export default { ...@@ -158,9 +171,13 @@ export default {
methods: { methods: {
cellClassName({ row, column, rowIndex, columnIndex }) { cellClassName({ row, column, rowIndex, columnIndex }) {
// console.log(column); // console.log(column);
const { property } = column; if (columnIndex == 0) {
if (editPropNames.includes(property)) { return "number-index-td";
return `can-edit-column-${property}`; } else {
const { property } = column;
if (editPropNames.includes(property)) {
return `can-edit-column-${property}`;
}
} }
return ""; return "";
}, },
...@@ -241,9 +258,9 @@ export default { ...@@ -241,9 +258,9 @@ export default {
// 判断当月是否存在于server返回month集合中 有传入的重置时间 采用重置时间 // 判断当月是否存在于server返回month集合中 有传入的重置时间 采用重置时间
const _now = this.getNowMonth(); const _now = this.getNowMonth();
if (resetDate && this.includeNowMonth(resetDate)) { if (resetDate && this.includeNowMonth(resetDate)) {
params["recordDate"] = resetDate; params["expenseDate"] = resetDate;
} else if (this.includeNowMonth(_now)) { } else if (this.includeNowMonth(_now)) {
params["recordDate"] = _now; params["expenseDate"] = _now;
} }
return params; return params;
}, },
...@@ -270,8 +287,7 @@ export default { ...@@ -270,8 +287,7 @@ export default {
const data = monthList.data; const data = monthList.data;
this.originMonthList = cloneDeep(data); this.originMonthList = cloneDeep(data);
const _now = this.getNowMonth(); const _now = this.getNowMonth();
this.recordDate = _now; this.expenseDate = _now;
// this.oldRecordDate = _now;
// 默认以当前月数据为准 若不包含当前月 需要手动push数据 // 默认以当前月数据为准 若不包含当前月 需要手动push数据
if (!data.includes(_now)) { if (!data.includes(_now)) {
data.push({ data.push({
...@@ -301,16 +317,16 @@ export default { ...@@ -301,16 +317,16 @@ export default {
const params = this.createRequestConditions(); const params = this.createRequestConditions();
// 清空了年月 默认选中当前月 // 清空了年月 默认选中当前月
if (!month) { if (!month) {
this.recordDate = _now; this.expenseDate = _now;
// 如果命中的旧月份 等于当前月 且 不处于编辑状态 说明清空的是默认查询月 不调用接口 // 如果命中的旧月份 等于当前月 且 不处于编辑状态 说明清空的是默认查询月 不调用接口
if (this.oldRecordDate == _now && !this.addActualCostEditStatus) return; if (this.oldExpenseDate == _now && !this.addActualCostEditStatus) return;
} else { } else {
// 正常选择 // 正常选择
params["recordDate"] = month; params["expenseDate"] = month;
} }
this.resetEditStatus(); this.resetEditStatus();
// 获取列表数据 // 获取列表数据
this.getFeedSummaryList(params); this.getCostSummaryList(params);
}, },
monthsSort(monthList) { monthsSort(monthList) {
const sortResult = monthList.sort((before, after) => { const sortResult = monthList.sort((before, after) => {
...@@ -325,15 +341,108 @@ export default { ...@@ -325,15 +341,108 @@ export default {
this.tableLoading = true; this.tableLoading = true;
const list = await getCostSummaryListApi(params); const list = await getCostSummaryListApi(params);
if (list.code == 200 && list.data instanceof Array) { if (list.code == 200 && list.data instanceof Array) {
const _temp = list.data; let _temp = list.data;
const _mapList = new Map();
// 如果有长度循环处理字段
if (_temp.length) {
_temp = _temp.map(item => {
if (!item.hasChildren) {
item.hasChildren = false;
} else {
// 有children
item.hasChildren = true;
if (item?.children?.length) {
item.children = item.children.map(childItem => {
childItem.hasChildren = childItem.hasChildren ? true : false;
return childItem;
});
}
};
// 储存将子级储存到map 主动调用展开菜单
item.hasChildren ? _mapList.set(item.id, item.children ? cloneDeep(item.children) : []) : null;
delete item.children;
return item;
});
}
console.log(_temp);
this.$set(this.dataForm, "tableDataList", cloneDeep(_temp)); this.$set(this.dataForm, "tableDataList", cloneDeep(_temp));
this.originTableDataList = cloneDeep(_temp); this.originTableDataList = cloneDeep(_temp);
this.total = _temp.length; this.total = _temp.length;
this.tableLoading = false;
await this.$nextTick();
const tableIns = this.$refs["costSummaryTable"].$refs["customTableRef"];
if (tableIns) {
_mapList.forEach((child, id) => {
// 打开一级目录
this.customResolve(id, child, tableIns);
});
}
} }
} catch (error) { } catch (error) {
console.log(error);
} finally {
this.tableLoading = false; this.tableLoading = false;
console.log(error);
}
},
// 模拟 resolve 懒加载
customResolve(id, child, tableIns) {
let children = child;
let newKey = id;
let treeNodeMap = tableIns.store.states.lazyTreeNodeMap;
let treeData = tableIns.store.states.treeData;
//treeData 添加父子关系和状态
let childrenids = Array.from(children).map(item => item.id);
let metaInfo = {
children: childrenids,
display: true,
expanded: true,
lazy: true,
level: "",
loaded: true,
loading: false
};
this.$set(treeData, newKey, metaInfo);
//lazyTreeNodeMap中 添加数据
this.$set(treeNodeMap, newKey, children);
console.log(treeData, "treeData");
console.log(treeNodeMap, "treeNodeMap");
},
async getCostSummaryListLazy(params = {}) {
try {
const list = await getCostSummaryListApi(params);
if (list.code == 200 && list.data instanceof Array) {
let _temp = list.data?.length ? list.data[0] : {};
_temp = _temp.children?.length ? _temp.children : [];
// 如果有长度循环处理字段
if (_temp.length) {
_temp = _temp.map(item => {
if (!item.hasChildren) {
item.hasChildren = false;
} else {
item.hasChildren = true;
};
return item;
});
}
return _temp;
}
} catch (error) {
console.log(error);
}
},
// 列表懒加载
async tableLazyLoad(row, treeNode, resolve) {
try {
const { id } = row;
const { cbType, expenseDate } = this.createRequestConditions();
const params = {
id,
cbType
};
expenseDate ? params["expenseDate"] = expenseDate : null;
const _lazyResult = await this.getCostSummaryListLazy(params);
resolve(_lazyResult ? _lazyResult : null);
} catch (error) {
} }
}, },
// 编辑状态下 进行了其它操作 // 编辑状态下 进行了其它操作
...@@ -351,7 +460,7 @@ export default { ...@@ -351,7 +460,7 @@ export default {
const index = this.monthList.findIndex(item => item.value == _selectActualCostTime); const index = this.monthList.findIndex(item => item.value == _selectActualCostTime);
if (index != -1) { if (index != -1) {
this.monthList.splice(index, 1); this.monthList.splice(index, 1);
this.recordDate = this.getNowMonth(); this.expenseDate = this.getNowMonth();
} }
} }
}, },
...@@ -360,8 +469,8 @@ export default { ...@@ -360,8 +469,8 @@ export default {
this.currentNodeValue = currentId; this.currentNodeValue = currentId;
const parentName = currentTemp.parent ? this.getCurrentType(currentTemp.parent) : currentId; const parentName = currentTemp.parent ? this.getCurrentType(currentTemp.parent) : currentId;
if (parentName) this.currentParentName = parentName; if (parentName) this.currentParentName = parentName;
const params = this.createRequestConditions(this.recordDate); const params = this.createRequestConditions(this.expenseDate);
this.getFeedSummaryList(params); this.getCostSummaryList(params);
}, },
}, },
} }
...@@ -509,7 +618,7 @@ export default { ...@@ -509,7 +618,7 @@ export default {
} }
::v-deep .custom-table-list-com-ins { ::v-deep .custom-table-list-com-ins {
.table-item { .custom-table-item {
.el-table { .el-table {
th { th {
height: 40px; height: 40px;
...@@ -518,6 +627,15 @@ export default { ...@@ -518,6 +627,15 @@ export default {
font-size: 14px; font-size: 14px;
font-weight: 350; font-weight: 350;
} }
.number-index-td {
.cell {
display: flex;
align-items: center;
.el-table__expand-icon {
margin-right: 5px;
}
}
}
.inner-edit-input-item { .inner-edit-input-item {
margin-bottom: 0px; margin-bottom: 0px;
......
...@@ -851,7 +851,7 @@ export default { ...@@ -851,7 +851,7 @@ export default {
} }
::v-deep .custom-table-list-com-ins { ::v-deep .custom-table-list-com-ins {
.table-item { .custom-table-item {
.el-table { .el-table {
th { th {
height: 40px; height: 40px;
......
...@@ -467,7 +467,7 @@ export default { ...@@ -467,7 +467,7 @@ export default {
} }
::v-deep .custom-table-list-com-ins { ::v-deep .custom-table-list-com-ins {
.table-item { .custom-table-item {
.el-table { .el-table {
th { th {
height: 40px; height: 40px;
......
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