Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dsk-operate-sys-cscec
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fulixin
dsk-operate-sys-cscec
Commits
346801f5
Commit
346801f5
authored
Mar 29, 2024
by
tyn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
成本汇总 工料汇总 滚动逻辑优化,节流
parent
2e8bda49
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
29 deletions
+61
-29
index.vue
...projectCostLedger/detail/components/CostSummary/index.vue
+38
-17
index.vue
...projectCostLedger/detail/components/FeedSummary/index.vue
+23
-12
No files found.
dsk-operate-ui/src/views/projectCostLedger/detail/components/CostSummary/index.vue
View file @
346801f5
...
...
@@ -219,6 +219,8 @@ export default {
{
trigger
:
[
"change"
],
validator
:
amountCheckValidator
}
]
},
// 竖向滚动条最后的位置
lastScrollTop
:
0
};
},
//可访问data属性
...
...
@@ -251,7 +253,7 @@ export default {
},
// 返回当前月是否在server month集合中
includeNowMonth
(
time
)
{
return
this
.
originMonthList
.
includes
(
time
);
return
this
.
originMonthList
.
find
(
item
=>
item
.
expenseDate
==
time
);
},
// 按项目汇总 按成本科目汇总
currentCategoryChange
(
category
)
{
...
...
@@ -261,9 +263,9 @@ export default {
this
.
tableLoading
=
true
;
this
.
init
(
this
.
comProjectDetailInfo
);
},
async
init
(
detail
=
{},
resetDate
=
""
)
{
async
init
(
detail
=
{},
resetDate
=
""
,
saveReset
=
false
)
{
try
{
this
.
resetEditStatus
();
this
.
resetEditStatus
(
saveReset
);
const
{
projectId
,
cbStage
}
=
detail
;
if
(
!
projectId
)
return
;
const
params
=
{
...
...
@@ -272,22 +274,22 @@ export default {
cbType
:
this
.
currentCategory
};
await
this
.
getCostSummaryMenuTree
(
params
);
await
this
.
getCostSummaryMonthList
(
params
);
await
this
.
getCostSummaryMonthList
(
params
,
saveReset
);
await
this
.
getLockMonthList
(
params
);
await
this
.
initDefaultSetting
(
resetDate
);
await
this
.
initDefaultSetting
(
resetDate
,
saveReset
);
}
catch
(
error
)
{
console
.
log
(
error
);
}
finally
{
this
.
tableLoading
=
false
;
}
},
async
initDefaultSetting
(
resetDate
=
""
)
{
async
initDefaultSetting
(
resetDate
=
""
,
saveReset
=
false
)
{
try
{
await
this
.
$nextTick
();
const
first
=
this
.
$refs
[
"projectSideMenu"
].
getFirstLevelWithDeepId
();
const
first
=
saveReset
?
this
.
currentNodeValue
:
this
.
$refs
[
"projectSideMenu"
].
getFirstLevelWithDeepId
();
const
menus
=
this
.
$refs
[
"projectSideMenu"
].
getResultMenuList
();
const
defaultCurrent
=
this
.
findMenuNode
(
menus
,
first
);
// 默认选中
结构劳务分包
// 默认选中
第一层级 第一个子菜单
if
(
defaultCurrent
)
{
this
.
currentNodeValue
=
defaultCurrent
.
nodeValue
;
const
parentId
=
defaultCurrent
.
parent
?
this
.
getCurrentType
(
defaultCurrent
.
parent
)
:
defaultCurrent
.
nodeName
;
...
...
@@ -350,14 +352,14 @@ export default {
}
},
async
getCostSummaryMonthList
(
params
)
{
async
getCostSummaryMonthList
(
params
,
saveReset
=
false
)
{
try
{
const
monthList
=
await
getCostSummaryMonthListApi
(
params
);
if
(
monthList
.
code
==
200
&&
monthList
.
data
instanceof
Array
)
{
const
data
=
monthList
.
data
;
this
.
originMonthList
=
cloneDeep
(
data
);
const
_now
=
this
.
getNowMonth
();
this
.
expenseDate
=
_now
;
this
.
expenseDate
=
saveReset
?
this
.
expenseDate
:
_now
;
// 默认以当前月数据为准 若不包含当前月 需要手动push数据
if
(
!
data
.
includes
(
_now
))
{
data
.
push
({
...
...
@@ -543,7 +545,7 @@ export default {
}
},
// 编辑状态下 进行了其它操作
resetEditStatus
()
{
resetEditStatus
(
saveReset
=
false
)
{
// 当前需要编辑或者新增的成本年份
const
_selectActualCostTime
=
this
.
selectActualCostTime
;
this
.
editCostMonthSelectDialog
=
false
;
...
...
@@ -554,9 +556,9 @@ export default {
* 默认本月
*/
if
(
!
_selectActualCostTime
)
return
;
if
(
!
this
.
originMonthList
.
includes
(
_selectActualCostTime
)
&&
_selectActualCostTime
!=
this
.
getNowMonth
())
{
if
(
!
this
.
originMonthList
.
find
(
item
=>
item
.
expenseDate
==
_selectActualCostTime
)
&&
_selectActualCostTime
!=
this
.
getNowMonth
())
{
const
index
=
this
.
monthList
.
findIndex
(
item
=>
item
.
expenseDate
==
_selectActualCostTime
);
if
(
index
!=
-
1
)
{
if
(
index
!=
-
1
&&
!
saveReset
)
{
this
.
monthList
.
splice
(
index
,
1
);
this
.
expenseDate
=
this
.
getNowMonth
();
}
...
...
@@ -651,7 +653,7 @@ export default {
this
.
addActualCostEditStatus
=
true
;
this
.
selectActualCostTime
=
selectTime
;
// 判断是否包含 选择的年月 包含则修改 未包含则新增
const
findReslut
=
this
.
originMonthList
.
includes
(
selectTime
)
||
this
.
monthList
.
find
(
item
=>
item
.
valu
e
==
selectTime
);
const
findReslut
=
this
.
originMonthList
.
includes
(
selectTime
)
||
this
.
monthList
.
find
(
item
=>
item
.
expenseDat
e
==
selectTime
);
const
params
=
this
.
createRequestConditions
();
if
(
!
findReslut
)
{
// 不包含当前所选月 新增数据
...
...
@@ -686,8 +688,9 @@ export default {
container
.
scrollTo
({
behavior
:
"smooth"
,
left
,
top
:
0
top
:
this
.
lastScrollTop
});
this
.
lastScrollTop
=
0
;
}
},
// 成本输入数据限制
...
...
@@ -703,14 +706,32 @@ export default {
if
(
flag
)
{
// 进行差异化对比
let
resultData
=
this
.
differentCompare
();
console
.
log
(
resultData
);
// 没有差异
if
(
!
resultData
.
length
)
{
this
.
resetEditStatus
();
const
params
=
this
.
createRequestConditions
(
this
.
expenseDate
);
await
this
.
getCostSummaryList
(
params
);
return
;
}
// 有差异数据 记录滚动条滚动位置
await
this
.
getLastScrollTop
();
const
result
=
await
saveCostModifyApi
(
resultData
);
if
(
result
.
code
==
200
)
{
this
.
$message
.
success
(
"保存成功"
);
await
this
.
init
(
this
.
comProjectDetailInfo
,
this
.
expenseDate
,
true
);
await
this
.
$nextTick
();
await
this
.
editRegionToViewPort
();
}
}
});
},
//获取竖向滚动条最后的位置
async
getLastScrollTop
()
{
const
table
=
document
.
querySelector
(
".custom-table .el-table__body-wrapper"
);
if
(
table
)
{
this
.
lastScrollTop
=
table
.
scrollTop
;
}
},
// 差异化比对
differentCompare
()
{
const
originData
=
this
.
originTableDataList
;
...
...
dsk-operate-ui/src/views/projectCostLedger/detail/components/FeedSummary/index.vue
View file @
346801f5
...
...
@@ -258,6 +258,7 @@ export default {
addActualCostEditStatus
:
false
,
// 当前选择的成本年份
selectActualCostTime
:
""
,
lastScrollTop
:
0
,
// 推送工程量弹窗
pushProjectUseDialog
:
false
,
// 推送工程量数据缓存
...
...
@@ -302,9 +303,9 @@ export default {
},
//方法集
methods
:
{
async
init
(
detail
=
{},
resetDate
=
""
)
{
async
init
(
detail
=
{},
resetDate
=
""
,
saveReset
=
false
)
{
try
{
this
.
resetEditStatus
();
this
.
resetEditStatus
(
saveReset
);
const
{
projectId
,
cbStage
}
=
detail
;
if
(
!
projectId
)
return
;
const
params
=
{
...
...
@@ -312,19 +313,19 @@ export default {
cbStage
};
await
this
.
getFeedSummaryMenuTree
(
params
);
await
this
.
getFeedSummaryMonthList
(
params
);
await
this
.
initDefaultSetting
(
resetDate
);
await
this
.
getFeedSummaryMonthList
(
params
,
saveReset
);
await
this
.
initDefaultSetting
(
resetDate
,
saveReset
);
}
catch
(
error
)
{
console
.
log
(
error
);
}
finally
{
this
.
tableLoading
=
false
;
}
},
async
initDefaultSetting
(
resetDate
=
""
)
{
async
initDefaultSetting
(
resetDate
=
""
,
saveReset
=
false
)
{
try
{
await
this
.
$nextTick
();
const
menus
=
this
.
$refs
[
"projectSideMenu"
].
getResultMenuList
();
const
defaultCurrent
=
this
.
findMenuNode
(
menus
,
"结构劳务分包"
);
const
defaultCurrent
=
this
.
findMenuNode
(
menus
,
saveReset
?
this
.
currentNodeName
:
"结构劳务分包"
);
// 默认选中结构劳务分包
if
(
defaultCurrent
)
{
this
.
currentNodeName
=
defaultCurrent
.
nodeName
;
...
...
@@ -427,14 +428,14 @@ export default {
}
},
async
getFeedSummaryMonthList
(
params
)
{
async
getFeedSummaryMonthList
(
params
,
saveReset
=
false
)
{
try
{
const
monthList
=
await
getFeedSummaryMonthListApi
(
params
);
if
(
monthList
.
code
==
200
&&
monthList
.
data
instanceof
Array
)
{
const
data
=
monthList
.
data
;
this
.
originMonthList
=
cloneDeep
(
data
);
const
_now
=
this
.
getNowMonth
();
this
.
recordDate
=
_now
;
this
.
recordDate
=
saveReset
?
this
.
recordDate
:
_now
;
// this.oldRecordDate = _now;
// 默认以当前月数据为准 若不包含当前月 需要手动push数据
if
(
!
data
.
includes
(
_now
))
{
...
...
@@ -652,16 +653,25 @@ export default {
recordDate
:
this
.
recordDate
};
});
// 有差异数据 记录滚动条滚动位置
await
this
.
getLastScrollTop
();
const
result
=
await
updateFeedSummaryRowsApi
(
resultData
);
if
(
result
.
code
==
200
)
{
this
.
$message
.
success
(
"保存成功"
);
await
this
.
init
(
this
.
comProjectDetailInfo
,
this
.
selectActualCostTim
e
);
await
this
.
init
(
this
.
comProjectDetailInfo
,
this
.
recordDate
,
tru
e
);
await
this
.
$nextTick
();
await
this
.
editRegionToViewPort
();
}
}
});
},
//获取竖向滚动条最后的位置
async
getLastScrollTop
()
{
const
table
=
document
.
querySelector
(
".custom-table .el-table__body-wrapper"
);
if
(
table
)
{
this
.
lastScrollTop
=
table
.
scrollTop
;
}
},
// 推送工程用量
pushProjectUse
(
row
)
{
if
(
!
row
.
id
)
return
;
...
...
@@ -702,7 +712,7 @@ export default {
return
cloneDeep
(
different
);
},
// 编辑状态下 进行了其它操作
resetEditStatus
()
{
resetEditStatus
(
saveReset
=
false
)
{
// 当前需要编辑或者新增的成本年份
const
_selectActualCostTime
=
this
.
selectActualCostTime
;
this
.
addActualCostEditStatus
=
false
;
...
...
@@ -714,7 +724,7 @@ export default {
if
(
!
_selectActualCostTime
)
return
;
if
(
!
this
.
originMonthList
.
includes
(
_selectActualCostTime
)
&&
_selectActualCostTime
!=
this
.
getNowMonth
())
{
const
index
=
this
.
monthList
.
findIndex
(
item
=>
item
.
value
==
_selectActualCostTime
);
if
(
index
!=
-
1
)
{
if
(
index
!=
-
1
&&
!
saveReset
)
{
this
.
monthList
.
splice
(
index
,
1
);
this
.
recordDate
=
this
.
getNowMonth
();
}
...
...
@@ -764,8 +774,9 @@ export default {
container
.
scrollTo
({
behavior
:
"smooth"
,
left
,
top
:
0
top
:
this
.
lastScrollTop
});
this
.
lastScrollTop
=
0
;
}
},
cellClassName
({
row
,
column
,
rowIndex
,
columnIndex
})
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment