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
b25928a8
Commit
b25928a8
authored
Mar 28, 2024
by
tianhongyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merge
parent
d94bd352
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
451 additions
and
67 deletions
+451
-67
index.js
dsk-operate-ui/src/api/projectCostLedger/index.js
+23
-1
decimal.js
dsk-operate-ui/src/utils/decimal.js
+8
-8
CostMonthSelect.vue
...ail/components/CostSummary/components/CostMonthSelect.vue
+230
-0
index.vue
...projectCostLedger/detail/components/CostSummary/index.vue
+180
-54
index.vue
...projectCostLedger/detail/components/FeedSummary/index.vue
+10
-4
No files found.
dsk-operate-ui/src/api/projectCostLedger/index.js
View file @
b25928a8
...
...
@@ -404,7 +404,7 @@ export const getCostSummaryMonthListApi = (params = {}) => request({
});
/**
* 获取成本汇总数据列表
* 获取成本汇总数据列表
懒加载
* @param {*} params
* @returns
*/
...
...
@@ -414,6 +414,17 @@ export const getCostSummaryListApi = (params = {}) => request({
params
});
/**
* 获取全量成本汇总列表
* @param {*} params
* @returns
*/
export
const
getCostSummaryAllListApi
=
(
params
=
{})
=>
request
({
url
:
"/cbSummary/allList"
,
method
:
"get"
,
params
});
/**
* 锁定成本前提示未填项
* @param {*} params
...
...
@@ -459,3 +470,14 @@ export const exportCostLockExcelApi = (data = {}) => request({
isFile
:
true
,
responseType
:
"blob"
});
/**
* 编辑成本 保存成本
* @param {*} data
* @returns
*/
export
const
saveCostModifyApi
=
(
data
=
{})
=>
request
({
url
:
"/cbSummary/editActual"
,
method
:
"put"
,
data
});
dsk-operate-ui/src/utils/decimal.js
View file @
b25928a8
...
...
@@ -6,13 +6,13 @@ import Decimal from "decimal.js";
* @param {*} num2
* @returns
*/
export
const
add
=
(
num1
,
num2
,
digit
=
9
,
omit
=
false
)
=>
{
export
const
add
=
(
num1
,
num2
,
digit
=
9
,
intLen
=
20
,
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
);
const
result
=
decimal1
.
plus
(
decimal2
);
return
omit
?
result
.
toFixed
(
digit
,
Decimal
.
ROUND_UP
)
:
result
.
toDecimalPlaces
(
digit
,
Decimal
.
ROUND_UP
).
toString
();
return
omit
?
result
.
toFixed
(
digit
,
Decimal
.
ROUND_UP
)
:
result
.
toDecimalPlaces
(
digit
,
Decimal
.
ROUND_UP
).
toS
ignificantDigits
(
intLen
).
toS
tring
();
};
/**
...
...
@@ -21,13 +21,13 @@ export const add = (num1, num2, digit = 9, omit = false) => {
* @param {*} num2
* @returns
*/
export
const
subtract
=
(
num1
,
num2
,
digit
=
9
,
omit
=
false
)
=>
{
export
const
subtract
=
(
num1
,
num2
,
digit
=
9
,
intLen
=
20
,
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
);
const
result
=
decimal1
.
minus
(
decimal2
);
return
omit
?
result
.
toFixed
(
digit
,
Decimal
.
ROUND_UP
)
:
result
.
toDecimalPlaces
(
digit
,
Decimal
.
ROUND_UP
).
toString
();
return
omit
?
result
.
toFixed
(
digit
,
Decimal
.
ROUND_UP
)
:
result
.
toDecimalPlaces
(
digit
,
Decimal
.
ROUND_UP
).
toS
ignificantDigits
(
intLen
).
toS
tring
();
};
/**
...
...
@@ -36,13 +36,13 @@ export const subtract = (num1, num2, digit = 9, omit = false) => {
* @param {*} num2
* @returns
*/
export
const
multiply
=
(
num1
,
num2
,
digit
=
9
,
omit
=
false
)
=>
{
export
const
multiply
=
(
num1
,
num2
,
digit
=
9
,
intLen
=
20
,
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
);
const
result
=
decimal1
.
times
(
decimal2
);
return
omit
?
result
.
toFixed
(
digit
,
Decimal
.
ROUND_UP
)
:
result
.
toDecimalPlaces
(
digit
,
Decimal
.
ROUND_UP
).
toString
();
return
omit
?
result
.
toFixed
(
digit
,
Decimal
.
ROUND_UP
)
:
result
.
toDecimalPlaces
(
digit
,
Decimal
.
ROUND_UP
).
toS
ignificantDigits
(
intLen
).
toS
tring
();
};
/**
...
...
@@ -51,13 +51,13 @@ export const multiply = (num1, num2, digit = 9, omit = false) => {
* @param {*} num2
* @returns
*/
export
const
divide
=
(
num1
,
num2
,
digit
=
9
,
omit
=
false
)
=>
{
export
const
divide
=
(
num1
,
num2
,
digit
=
9
,
intLen
=
20
,
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
);
const
result
=
decimal1
.
dividedBy
(
decimal2
);
return
omit
?
result
.
toFixed
(
digit
,
Decimal
.
ROUND_UP
)
:
result
.
toDecimalPlaces
(
digit
,
Decimal
.
ROUND_UP
).
toString
();
return
omit
?
result
.
toFixed
(
digit
,
Decimal
.
ROUND_UP
)
:
result
.
toDecimalPlaces
(
digit
,
Decimal
.
ROUND_UP
).
toS
ignificantDigits
(
intLen
).
toS
tring
();
};
// 检测结果是否是负数
...
...
dsk-operate-ui/src/views/projectCostLedger/detail/components/CostSummary/components/CostMonthSelect.vue
0 → 100644
View file @
b25928a8
<
template
>
<el-dialog
title=
"填写实际成本"
:visible=
"comDialogStatus"
class=
"cost-month-select-container"
@
close=
"dialogClose"
:destroy-on-close=
"true"
:close-on-click-modal=
"false"
>
<div
class=
" dialog-content-inner"
>
<!-- 成本年份 -->
<div
class=
"cost-year-container"
>
<span>
成本年份
</span>
<el-date-picker
v-model=
"time"
type=
"month"
placeholder=
"请选择所需要添加的成本月份"
format=
"yyyy年MM月"
value-format=
"yyyy-MM"
class=
"project-record-date"
@
change=
"timeChange"
:picker-options=
"pickerOptions"
></el-date-picker>
</div>
</div>
<!-- 底部按钮 -->
<div
class=
"dialog-content-footer"
>
<div
class=
"cancel-or-ok"
>
<el-button
size=
"medium"
@
click=
"cancel"
class=
"cancel-select-year"
>
取消
</el-button>
<el-button
type=
"primary"
size=
"medium"
@
click=
"ok"
class=
"ok-select-year"
>
确定
</el-button>
</div>
</div>
</el-dialog>
</
template
>
<
script
>
import
dayjs
from
"dayjs"
;
export
default
{
name
:
"costMonthSelect"
,
props
:
{
dialogStatus
:
{
type
:
Boolean
,
default
:
false
},
projectCreateTime
:
{
type
:
String
,
default
:
""
},
disableMonths
:
{
type
:
Array
,
default
:
()
=>
[]
}
},
model
:
{
prop
:
"dialogStatus"
,
event
:
"dialogStatusChange"
},
watch
:
{
dialogStatus
(
newValue
)
{
this
.
comDialogStatus
=
newValue
;
}
},
data
()
{
return
{
comDialogStatus
:
this
.
dialogStatus
,
time
:
""
,
pickerOptions
:
{
disabledDate
:
this
.
disabledDateHandler
}
};
},
//可访问data属性
created
()
{
},
//计算集
computed
:
{
},
//方法集
methods
:
{
// 时间选择变化
timeChange
(
time
)
{
// console.log(time);
},
cancel
()
{
this
.
comDialogStatus
=
false
;
},
ok
()
{
if
(
!
this
.
time
)
{
return
this
.
$message
.
error
(
"请选择成本年份"
);
}
// 发布事件
this
.
$emit
(
"timeSelect"
,
dayjs
(
this
.
time
).
format
(
"YYYYMM"
));
this
.
comDialogStatus
=
false
;
},
reset
()
{
this
.
time
=
""
;
},
dialogClose
()
{
this
.
$emit
(
"dialogStatusChange"
,
false
);
this
.
reset
();
},
disabledDateHandler
(
optionTime
)
{
// 选项年月
const
_optionTime
=
dayjs
(
optionTime
).
format
(
"YYYYMM"
);
// 当前项目年月
const
_thresholdTime
=
dayjs
(
this
.
projectCreateTime
).
format
(
"YYYYMM"
);
// 当前项目年
const
_thresholdYear
=
_thresholdTime
.
slice
(
0
,
4
);
// 当前项目月份 补0
const
_thresholdMonth
=
_thresholdTime
.
slice
(
4
);
// 是否小于当前项目年月 或 大于 当前项目年月 往后推五年 以及成本月份被锁定 禁用
const
lastYearMonth
=
parseInt
(
`
${
parseInt
(
_thresholdYear
)
+
5
}${
_thresholdMonth
}
`
);
if
(
parseInt
(
_optionTime
)
<
parseInt
(
_thresholdTime
)
||
parseInt
(
_optionTime
)
>
lastYearMonth
||
this
.
disableMonths
.
includes
(
_optionTime
))
{
return
true
;
}
return
false
;
}
},
}
</
script
>
<
style
lang=
"scss"
scoped
>
.cost-month-select-container
{
::v-deep
.el-dialog
{
margin-top
:
0px
!
important
;
position
:
absolute
;
left
:
50%
;
top
:
50%
;
transform
:
translate
(
-50%
,
-50%
);
border-radius
:
4px
;
width
:
480px
;
.el-dialog__header
{
height
:
56px
;
padding
:
0px
20px
;
display
:
flex
;
align-items
:
center
;
justify-content
:
space-between
;
border-bottom
:
1px
solid
#eeeeee
;
box-sizing
:
border-box
;
.el-dialog__title
{
font-size
:
16px
;
font-weight
:
bold
;
color
:
#232323
;
}
.el-dialog__headerbtn
{
position
:
static
;
width
:
16px
;
height
:
16px
;
.el-dialog__close
{
font-size
:
16px
;
}
}
}
.el-dialog__body
{
padding
:
0px
;
box-sizing
:
border-box
;
.dialog-content-inner
{
min-height
:
120px
;
padding
:
24px
20px
;
}
.cost-year-container
{
display
:
flex
;
align-items
:
center
;
&
>
span
{
color
:
rgba
(
35
,
35
,
35
,
0
.8
);
font-size
:
14px
;
margin-right
:
16px
;
white-space
:
nowrap
;
}
.project-record-date
{
width
:
100%
;
.el-input__inner
{
height
:
30px
;
line-height
:
30px
;
padding
:
0px
12px
;
border-radius
:
2px
;
border-color
:
#dcdfe6
;
font-size
:
14px
;
color
:
#232323
;
font-weight
:
350
;
}
.el-input__suffix
{
right
:
12px
;
.el-input__icon
{
line-height
:
30px
;
width
:
auto
;
}
}
.el-input__prefix
{
display
:
none
;
}
}
}
.dialog-content-footer
{
height
:
64px
;
padding
:
0px
20px
;
display
:
flex
;
justify-content
:
flex-end
;
align-items
:
center
;
border-top
:
1px
solid
#eeeeee
;
box-sizing
:
border-box
;
.cancel-or-ok
{
display
:
flex
;
height
:
100%
;
align-items
:
center
;
.el-button
{
padding
:
0px
16px
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
height
:
32px
;
font-size
:
14px
;
&
.cancel-select-year
{
color
:
rgba
(
35
,
35
,
35
,
0
.8
);
border
:
1px
solid
#dcdfe6
;
background
:
#fff
;
}
&
.ok-select-year
{
background
:
#0081ff
;
border-color
:
#0081ff
;
}
}
}
}
}
}
}
</
style
>
dsk-operate-ui/src/views/projectCostLedger/detail/components/CostSummary/index.vue
View file @
b25928a8
This diff is collapsed.
Click to expand it.
dsk-operate-ui/src/views/projectCostLedger/detail/components/FeedSummary/index.vue
View file @
b25928a8
...
...
@@ -51,7 +51,8 @@
<!-- 编辑单元格 -->
<el-form-item
:prop=
"`tableDataList.$
{scope.rowIndex}.quantities`" :rules="checkRules.amountCheck"
v-if="rowCanEditInput(scope.rowIndex,hasTarget)
&&
addActualCostEditStatus" class="inner-edit-input-item">
<el-input
placeholder=
"请输入"
v-model=
"scope.row.quantities"
clearable
@
input=
"v => statisticsSum(v,'quantities')"
></el-input>
<el-input
placeholder=
"请输入"
v-model=
"scope.row.quantities"
clearable
@
input=
"v => statisticsSum(v,'quantities',scope.row)"
></el-input>
</el-form-item>
</
template
>
<!-- 本月采购单价 -->
...
...
@@ -60,7 +61,7 @@
<el-form-item
:prop=
"`tableDataList.$
{scope.rowIndex}.purchaseUnitPrice`" :rules="checkRules.amountCheck"
v-if="rowCanEditInput(scope.rowIndex,hasTarget)
&&
addActualCostEditStatus" class="inner-edit-input-item">
<el-input
placeholder=
"请输入"
v-model=
"scope.row.purchaseUnitPrice"
clearable
@
input=
"v => statisticsSum(v,'purchaseUnitPrice')"
></el-input>
@
input=
"v => statisticsSum(v,'purchaseUnitPrice'
,scope.row
)"
></el-input>
</el-form-item>
</
template
>
</custom-table>
...
...
@@ -595,8 +596,12 @@ export default {
this
.
statisticsTimer
=
null
;
},
// 实时统计
statisticsSum
(
value
,
prop
)
{
statisticsSum
(
value
,
prop
,
row
)
{
this
.
clearStatisticsTimer
();
const
reg
=
/^
(?!
0
\d)(?!
0+$
)(?!
0*
\.
0*$
)\d
+
(\.\d
+
)?
$/
;
if
(
reg
.
test
(
value
))
{
row
[
prop
]
=
add
(
0
,
value
);
}
// 填写一秒后触发
this
.
statisticsTimer
=
setTimeout
(()
=>
{
const
sum
=
this
.
sumHandler
(
this
.
dataForm
.
tableDataList
,
prop
,
this
.
hasTarget
);
...
...
@@ -651,6 +656,7 @@ export default {
if
(
result
.
code
==
200
)
{
this
.
$message
.
success
(
"保存成功"
);
await
this
.
init
(
this
.
comProjectDetailInfo
,
this
.
selectActualCostTime
);
await
this
.
$nextTick
();
await
this
.
editRegionToViewPort
();
}
}
...
...
@@ -741,10 +747,10 @@ export default {
// 获取选中月数据
await
this
.
getFeedSummaryList
(
params
);
// 将编辑区域移动到视口
await
this
.
$nextTick
();
await
this
.
editRegionToViewPort
();
},
async
editRegionToViewPort
()
{
await
this
.
$nextTick
();
// 获取编辑列所处位置
const
container
=
document
.
querySelector
(
".el-table__body-wrapper"
);
/**
...
...
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