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
e882f19d
Commit
e882f19d
authored
Mar 13, 2024
by
tianhongyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merge
parent
ad7add2d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
159 additions
and
31 deletions
+159
-31
index.js
dsk-operate-ui/src/api/projectCostLedger/index.js
+11
-0
index.vue
dsk-operate-ui/src/components/CustomTable/index.vue
+2
-1
decimal.js
dsk-operate-ui/src/utils/decimal.js
+11
-8
index.vue
...projectCostLedger/detail/components/FeedSummary/index.vue
+134
-20
index.vue
...ectCostLedger/detail/components/ProjectSideMenu/index.vue
+1
-0
index.vue
dsk-operate-ui/src/views/projectCostLedger/detail/index.vue
+0
-2
No files found.
dsk-operate-ui/src/api/projectCostLedger/index.js
View file @
e882f19d
...
...
@@ -262,6 +262,17 @@ export const updateFeedSummaryRowsApi = (data) => request({
data
});
/**
* 推送工程用量
* @param {*} data
* @returns
*/
export
const
pushFeedSummaryRowsApi
=
(
data
)
=>
request
({
url
:
"/cb/quantity/summary/pushData"
,
method
:
"put"
,
data
});
//工程项目信息
...
...
dsk-operate-ui/src/components/CustomTable/index.vue
View file @
e882f19d
...
...
@@ -315,10 +315,11 @@ export default {
.el-table__fixed-right-patch
{
width
:
16px
!
important
;
z-index
:
9
;
top
:
0px
;
background
:
#f0f3fa
;
border
:
1px
solid
#e6eaf1
;
border-left
:
unset
;
border-
bottom
:
unset
;
border-
top
:
unset
;
}
// 自动适配下 减去滚动条高度
.el-table__fixed
{
...
...
dsk-operate-ui/src/utils/decimal.js
View file @
e882f19d
...
...
@@ -6,12 +6,12 @@ import Decimal from "decimal.js";
* @param {*} num2
* @returns
*/
export
const
add
=
(
num1
,
num2
)
=>
{
export
const
add
=
(
num1
,
num2
,
digit
=
9
,
omit
=
false
)
=>
{
const
flag
=
(
!
parseFloat
(
num1
)
&&
parseFloat
(
num1
)
!=
"0"
)
||
(
!
parseFloat
(
num2
)
&&
parseFloat
(
num2
)
!=
"0"
);
if
(
flag
)
throw
new
Error
(
"传入参数错误,参数不为number"
);
const
decimal1
=
new
Decimal
(
num1
);
const
decimal2
=
new
Decimal
(
num2
);
return
decimal1
.
plus
(
decimal2
).
toString
();
return
decimal1
.
plus
(
decimal2
).
to
DecimalPlaces
(
digit
,
Decimal
.
ROUND_UP
).
to
String
();
};
/**
...
...
@@ -20,11 +20,12 @@ export const add = (num1, num2) => {
* @param {*} num2
* @returns
*/
export
const
subtract
=
(
num1
,
num2
)
=>
{
export
const
subtract
=
(
num1
,
num2
,
digit
=
9
)
=>
{
const
flag
=
(
!
parseFloat
(
num1
)
&&
parseFloat
(
num1
)
!=
"0"
)
||
(
!
parseFloat
(
num2
)
&&
parseFloat
(
num2
)
!=
"0"
);
if
(
flag
)
throw
new
Error
(
"传入参数错误,参数不为number"
);
const
decimal1
=
new
Decimal
(
num1
);
const
decimal2
=
new
Decimal
(
num2
);
return
decimal1
.
minus
(
decimal2
).
toString
();
return
decimal1
.
minus
(
decimal2
).
to
DecimalPlaces
(
digit
,
Decimal
.
ROUND_UP
).
to
String
();
};
/**
...
...
@@ -33,11 +34,12 @@ export const subtract = (num1, num2) => {
* @param {*} num2
* @returns
*/
export
const
multiply
=
(
num1
,
num2
)
=>
{
export
const
multiply
=
(
num1
,
num2
,
digit
=
9
)
=>
{
const
flag
=
(
!
parseFloat
(
num1
)
&&
parseFloat
(
num1
)
!=
"0"
)
||
(
!
parseFloat
(
num2
)
&&
parseFloat
(
num2
)
!=
"0"
);
if
(
flag
)
throw
new
Error
(
"传入参数错误,参数不为number"
);
const
decimal1
=
new
Decimal
(
num1
);
const
decimal2
=
new
Decimal
(
num2
);
return
decimal1
.
times
(
decimal2
).
toString
();
return
decimal1
.
times
(
decimal2
).
to
DecimalPlaces
(
digit
,
Decimal
.
ROUND_UP
).
to
String
();
};
/**
...
...
@@ -46,9 +48,10 @@ export const multiply = (num1, num2) => {
* @param {*} num2
* @returns
*/
export
const
divide
=
(
num1
,
num2
)
=>
{
export
const
divide
=
(
num1
,
num2
,
digit
=
9
)
=>
{
const
flag
=
(
!
parseFloat
(
num1
)
&&
parseFloat
(
num1
)
!=
"0"
)
||
(
!
parseFloat
(
num2
)
&&
parseFloat
(
num2
)
!=
"0"
);
if
(
flag
)
throw
new
Error
(
"传入参数错误,参数不为number"
);
const
decimal1
=
new
Decimal
(
num1
);
const
decimal2
=
new
Decimal
(
num2
);
return
decimal1
.
dividedBy
(
decimal2
).
toString
();
return
decimal1
.
dividedBy
(
decimal2
).
to
DecimalPlaces
(
digit
,
Decimal
.
ROUND_UP
).
to
String
();
};
dsk-operate-ui/src/views/projectCostLedger/detail/components/FeedSummary/index.vue
View file @
e882f19d
...
...
@@ -46,12 +46,19 @@
</
template
>
<!-- 本月工程量 -->
<
template
slot=
"quantities"
slot-scope=
"scope"
>
<!-- 统计行 -->
<template
v-if=
"scope.rowIndex == '0'"
>
</
template
>
<el-form-item
v-else-if=
"addActualCostEditStatus"
>
<!-- 编辑单元格 -->
<el-form-item
:prop=
"`tableDataList.$
{scope.rowIndex}.quantities`" :rules="checkRules.amountCheck"
v-if="scope.rowIndex != '0'
&&
addActualCostEditStatus" class="inner-edit-input-item">
<el-input
placeholder=
"请输入"
v-model=
"scope.row.quantities"
clearable
@
input=
"v => statisticsSum(v,'quantities')"
></el-input>
</el-form-item>
</
template
>
<!-- 本月采购单价 -->
<
template
slot=
"purchaseUnitPrice"
slot-scope=
"scope"
>
<!-- 编辑单元格 -->
<el-form-item
:prop=
"`tableDataList.$
{scope.rowIndex}.purchaseUnitPrice`" :rules="checkRules.amountCheck"
v-if="scope.rowIndex != '0'
&&
addActualCostEditStatus" class="inner-edit-input-item">
<el-input
placeholder=
"请输入"
v-model=
"scope.row.purchaseUnitPrice"
clearable
@
input=
"v => statisticsSum(v,'purchaseUnitPrice')"
></el-input>
</el-form-item>
</
template
>
</custom-table>
...
...
@@ -67,7 +74,7 @@
</template>
<
script
>
import
ProjectSideMenu
from
"@/views/projectCostLedger/detail/components/ProjectSideMenu"
;
import
{
getFeedSummaryMenuTreeApi
,
getFeedSummaryMonthListApi
,
getFeedSummaryListApi
,
getFeedSummaryConversionNotice
,
updateFeedSummaryRowsApi
}
from
"@/api/projectCostLedger"
;
import
{
getFeedSummaryMenuTreeApi
,
getFeedSummaryMonthListApi
,
getFeedSummaryListApi
,
getFeedSummaryConversionNotice
,
updateFeedSummaryRowsApi
,
pushFeedSummaryRowsApi
}
from
"@/api/projectCostLedger"
;
import
DskTableHeaderSetting
from
"@/components/DskTableHeaderSetting"
;
import
DskSkeleton
from
"@/components/DskSkeleton"
;
import
CustomTable
from
"@/components/CustomTable"
;
...
...
@@ -93,9 +100,7 @@ const statisticsPropNames = [
// 可编辑字段
const
editPropNames
=
[
"quantities"
,
"totalQuantities"
,
"purchaseUnitPrice"
,
"createTime"
];
export
default
{
...
...
@@ -135,6 +140,14 @@ export default {
AddActualCost
},
data
()
{
const
amountCheckValidator
=
(
rule
,
value
,
callback
)
=>
{
// 有值才进行验证
if
(
value
||
value
==
"0"
)
{
const
reg
=
/^
(?!
0
\d)(?!
0*
\.
0*$
)\d
+
(\.\d
+
)?
$/
;
if
(
!
reg
.
test
(
value
))
return
callback
(
new
Error
(
"请输入正确的数值"
));
}
callback
();
};
return
{
menuOptions
:
{
nodeName
:
"name"
,
...
...
@@ -171,10 +184,10 @@ export default {
},
{
label
:
'实际成本'
,
prop
:
"sjcb"
,
align
:
"center"
,
uid
:
v4
(),
children
:
[
{
label
:
'本月工程量'
,
prop
:
"quantities"
,
minWidth
:
"1
5
0"
,
uid
:
v4
(),
slot
:
true
},
{
label
:
'截止本月工程量'
,
prop
:
"totalQuantities"
,
minWidth
:
"1
5
0"
,
uid
:
v4
(),
slot
:
true
},
{
label
:
'本月采购单价'
,
prop
:
"purchaseUnitPrice"
,
minWidth
:
"1
5
0"
,
uid
:
v4
(),
slot
:
true
},
{
label
:
'填写时间'
,
prop
:
"createTime"
,
minWidth
:
"1
5
0"
,
uid
:
v4
(),
slot
:
true
},
{
label
:
'本月工程量'
,
prop
:
"quantities"
,
minWidth
:
"1
6
0"
,
uid
:
v4
(),
slot
:
true
},
{
label
:
'截止本月工程量'
,
prop
:
"totalQuantities"
,
minWidth
:
"1
6
0"
,
uid
:
v4
(),
slot
:
true
},
{
label
:
'本月采购单价'
,
prop
:
"purchaseUnitPrice"
,
minWidth
:
"1
6
0"
,
uid
:
v4
(),
slot
:
true
},
{
label
:
'填写时间'
,
prop
:
"createTime"
,
minWidth
:
"1
6
0"
,
uid
:
v4
(),
slot
:
true
},
]
},
{
label
:
'推送工程量'
,
prop
:
"pushQuantities"
,
width
:
"95"
,
uid
:
v4
()
},
...
...
@@ -205,13 +218,22 @@ export default {
// 填写实际成本 编辑状态
addActualCostEditStatus
:
false
,
// 当前选择的成本年份
selectActualCostTime
:
""
selectActualCostTime
:
""
,
checkRules
:
{
amountCheck
:
[
{
trigger
:
[
"change"
],
validator
:
amountCheckValidator
}
]
},
statisticsTimer
:
null
};
},
//可访问data属性
created
()
{
this
.
init
(
this
.
comProjectDetailInfo
);
},
beforeDestroy
()
{
this
.
clearStatisticsTimer
();
},
//计算集
computed
:
{
hasTarget
()
{
...
...
@@ -222,6 +244,7 @@ export default {
methods
:
{
async
init
(
detail
=
{})
{
try
{
this
.
resetEditStatus
();
const
{
projectId
,
cbStage
}
=
detail
;
if
(
!
projectId
)
return
;
const
params
=
{
...
...
@@ -323,11 +346,7 @@ export default {
}
// 循环统计 需要统计的列 总数
for
(
const
prop
of
_statisticsPropNames
)
{
const
sum
=
arraylist
.
reduce
((
pre
,
current
,
index
)
=>
{
const
before
=
Object
.
prototype
.
toString
.
call
(
pre
)
==
"[object Object]"
?
pre
[
prop
]
?
pre
[
prop
]
:
0
:
parseFloat
(
pre
)
?
pre
:
0
;
const
after
=
Object
.
prototype
.
toString
.
call
(
current
)
==
"[object Object]"
?
current
[
prop
]
?
current
[
prop
]
:
0
:
parseFloat
(
current
)
?
current
:
0
;
return
add
(
before
,
after
);
},
0
);
const
sum
=
this
.
sumHandler
(
arraylist
,
prop
);
// 对应key 赋值结果
_template
[
prop
]
=
sum
;
}
...
...
@@ -461,9 +480,74 @@ export default {
fillActualCost
()
{
this
.
showAddActualCost
=
true
;
},
clearStatisticsTimer
()
{
clearTimeout
(
this
.
statisticsTimer
);
this
.
statisticsTimer
=
null
;
},
// 实时统计
statisticsSum
(
value
,
prop
)
{
this
.
clearStatisticsTimer
();
// 填写一秒后触发
this
.
statisticsTimer
=
setTimeout
(()
=>
{
const
sum
=
this
.
sumHandler
(
this
.
dataForm
.
tableDataList
,
prop
,
true
);
// 更新统计值
this
.
$set
(
this
.
dataForm
.
tableDataList
[
0
],
prop
,
sum
);
},
500
);
},
sumHandler
(
dataList
,
prop
,
hasTotal
=
false
)
{
const
reg
=
/^
(?!
0
\d)(?!
0*
\.
0*$
)\d
+
(\.\d
+
)?
$/
;
const
sum
=
dataList
.
reduce
((
pre
,
current
,
index
)
=>
{
if
(
hasTotal
&&
index
==
0
)
return
0
;
const
before
=
Object
.
prototype
.
toString
.
call
(
pre
)
==
"[object Object]"
?
reg
.
test
(
pre
[
prop
])
?
pre
[
prop
]
:
0
:
parseFloat
(
pre
)
?
pre
:
0
;
const
after
=
Object
.
prototype
.
toString
.
call
(
current
)
==
"[object Object]"
?
reg
.
test
(
current
[
prop
])
?
current
[
prop
]
:
0
:
parseFloat
(
current
)
?
current
:
0
;
return
add
(
before
,
after
);
},
0
);
return
sum
;
},
// 保存
saveActualCost
()
{
this
.
$refs
[
"feedSummaryForm"
].
validate
(
async
flag
=>
{
if
(
flag
)
{
// 进行差异化对比
let
resultData
=
this
.
differentCompare
();
console
.
log
(
resultData
,
"差异数据"
);
if
(
!
resultData
.
length
)
{
this
.
resetEditStatus
();
const
params
=
this
.
createRequestConditions
();
await
this
.
getFeedSummaryList
(
params
);
}
// 有差异提交数据
resultData
=
resultData
.
map
(
item
=>
{
return
{
id
:
item
.
actualId
,
cbQuantitySummaryId
:
item
.
id
,
quantities
:
item
.
quantities
?
item
.
quantities
:
0
,
purchaseUnitPrice
:
item
.
purchaseUnitPrice
?
item
.
purchaseUnitPrice
:
0
,
recordDate
:
this
.
recordDate
};
});
const
result
=
await
updateFeedSummaryRowsApi
(
resultData
);
if
(
result
.
code
==
200
)
{
this
.
$message
.
success
(
"保存成功"
);
await
this
.
init
(
this
.
comProjectDetailInfo
);
}
}
});
},
differentCompare
()
{
const
originData
=
this
.
originTableDataList
;
/**
* @type {Array<object>}
*/
let
data
=
cloneDeep
(
this
.
dataForm
.
tableDataList
);
const
different
=
data
.
filter
((
item
,
index
)
=>
{
if
(
index
==
0
)
return
false
;
const
flag
=
editPropNames
.
some
(
prop
=>
{
return
item
[
prop
]
!=
originData
[
index
][
prop
];
});
return
flag
;
});
return
cloneDeep
(
different
);
},
// 编辑状态下 进行了其它操作
resetEditStatus
()
{
...
...
@@ -479,6 +563,7 @@ export default {
const
index
=
this
.
monthList
.
findIndex
(
item
=>
item
.
value
==
_selectActualCostTime
);
if
(
index
!=
-
1
)
{
this
.
monthList
.
splice
(
index
,
1
);
this
.
recordDate
=
this
.
getNowMonth
();
}
}
},
...
...
@@ -640,6 +725,35 @@ export default {
font-size
:
14px
;
font-weight
:
350
;
}
.inner-edit-input-item
{
margin-bottom
:
0px
;
.el-form-item__content
{
line-height
:
32px
;
}
&
.is-error
{
.el-input__inner
{
&
:focus
{
border-color
:
#ff4949
;
}
}
}
.el-input__inner
{
line-height
:
32px
;
height
:
32px
;
border-radius
:
2px
;
padding-left
:
8px
;
&
:focus
{
border-color
:
#0081ff
;
}
}
.el-input__clear
{
line-height
:
32px
;
}
}
}
}
}
...
...
dsk-operate-ui/src/views/projectCostLedger/detail/components/ProjectSideMenu/index.vue
View file @
e882f19d
...
...
@@ -142,6 +142,7 @@ export default {
this
.
$emit
(
"close"
,
menuPath
,
menuPathArray
);
},
menuSelect
(
menuPath
)
{
if
(
this
.
comDefaultActive
==
menuPath
)
return
;
const
result
=
this
.
getCurrentData
(
menuPath
);
this
.
$emit
(
"select"
,
menuPath
,
result
);
},
...
...
dsk-operate-ui/src/views/projectCostLedger/detail/index.vue
View file @
e882f19d
...
...
@@ -198,8 +198,6 @@ 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;
this
.
detailInfo
=
detail
.
data
;
}
}
catch
(
error
)
{
...
...
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