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
2e8bda49
Commit
2e8bda49
authored
Mar 28, 2024
by
tyn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
成本汇总 工料汇总 差异化计算方式 优化
parent
4d479524
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
3 deletions
+69
-3
index.vue
...projectCostLedger/detail/components/CostSummary/index.vue
+66
-2
index.vue
...projectCostLedger/detail/components/FeedSummary/index.vue
+3
-1
No files found.
dsk-operate-ui/src/views/projectCostLedger/detail/components/CostSummary/index.vue
View file @
2e8bda49
...
...
@@ -465,6 +465,21 @@ export default {
console
.
log
(
error
);
}
},
// 将需要编辑的值 设置为默认值 0
setEditPropDefaultValue
(
list
=
[],
editPropsArray
=
[])
{
const
result
=
list
.
map
(
item
=>
{
editPropsArray
.
forEach
(
prop
=>
{
if
(
!
item
[
prop
])
{
item
[
prop
]
=
0
;
}
});
if
(
item
?.
children
?.
length
)
{
this
.
setEditPropDefaultValue
(
item
?.
children
,
editPropsArray
);
}
return
item
;
});
return
result
;
},
// 模拟 resolve 懒加载
customResolve
(
id
,
child
,
tableIns
)
{
let
children
=
child
;
...
...
@@ -684,7 +699,58 @@ export default {
},
//保存成本
saveCostModify
()
{
this
.
$refs
[
"costSummaryForm"
].
validate
(
async
flag
=>
{
if
(
flag
)
{
// 进行差异化对比
let
resultData
=
this
.
differentCompare
();
console
.
log
(
resultData
);
// 没有差异
if
(
!
resultData
.
length
)
{
}
}
});
},
// 差异化比对
differentCompare
()
{
const
originData
=
this
.
originTableDataList
;
/**
* @type {Array<object>}
*/
let
data
=
cloneDeep
(
this
.
dataForm
.
tableDataList
);
// 差异数据
const
different
=
this
.
getDeepDifferentData
(
data
,
originData
);
return
cloneDeep
(
different
);
},
// 深度差异化对比
getDeepDifferentData
(
data
=
[],
originData
=
[],
tempArray
=
[])
{
const
len
=
data
.
length
;
for
(
let
index
=
0
;
index
<
len
;
index
++
)
{
const
item
=
data
[
index
];
// 源数据
const
originItem
=
originData
[
index
];
// 查看可编辑字段是否存在任意一处 数据不同
const
hasDifferent
=
editPropNames
.
some
(
prop
=>
{
// 两个皆为无效值 返回false
if
(
!
parseFloat
(
item
[
prop
])
&&
!
parseFloat
(
originItem
[
prop
]))
return
false
;
return
item
[
prop
]
!=
originItem
[
prop
];
});
// 浅层级
if
(
hasDifferent
)
{
tempArray
.
push
({
id
:
item
.
id
,
cbSummaryId
:
this
.
currentNodeValue
,
taxInclusiveExpense
:
item
.
taxInclusiveExpense
?
item
.
taxInclusiveExpense
:
0
,
taxExclusiveExpense
:
item
.
taxExclusiveExpense
?
item
.
taxExclusiveExpense
:
0
,
expenseDate
:
this
.
expenseDate
});
}
// 递归深层级
if
(
item
?.
children
?.
length
)
{
this
.
getDeepDifferentData
(
item
.
children
,
originItem
.
children
,
tempArray
);
}
}
return
tempArray
;
},
// 获取当前树形结构下 输入框prop的完整路径
getTableTreeProp
(
dataList
=
[],
rowId
,
pathArray
=
[])
{
...
...
@@ -693,11 +759,9 @@ export default {
const
item
=
dataList
[
index
];
// 返回所在下标index
if
(
item
.
id
===
rowId
)
{
// return `${pathStr}${index}`;
return
[...
pathArray
,
index
].
join
(
""
);
}
if
(
item
?.
children
?.
length
)
{
// const childPath = `${pathStr}${index}.children.`;
const
childPath
=
[...
pathArray
,
index
,
'.children.'
];
const
result
=
this
.
getTableTreeProp
(
item
.
children
,
rowId
,
childPath
);
if
(
result
)
{
...
...
dsk-operate-ui/src/views/projectCostLedger/detail/components/FeedSummary/index.vue
View file @
2e8bda49
...
...
@@ -691,8 +691,10 @@ export default {
*/
let
data
=
cloneDeep
(
this
.
dataForm
.
tableDataList
);
const
different
=
data
.
filter
((
item
,
index
)
=>
{
if
(
index
==
0
)
return
false
;
if
(
index
==
0
&&
this
.
hasTarget
)
return
false
;
const
flag
=
editPropNames
.
some
(
prop
=>
{
// 两个皆为无效值 返回false
if
(
!
parseFloat
(
item
[
prop
])
&&
!
parseFloat
(
originData
[
index
][
prop
]))
return
false
;
return
item
[
prop
]
!=
originData
[
index
][
prop
];
});
return
flag
;
...
...
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