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
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({
...
@@ -404,7 +404,7 @@ export const getCostSummaryMonthListApi = (params = {}) => request({
});
});
/**
/**
* 获取成本汇总数据列表
* 获取成本汇总数据列表
懒加载
* @param {*} params
* @param {*} params
* @returns
* @returns
*/
*/
...
@@ -414,6 +414,17 @@ export const getCostSummaryListApi = (params = {}) => request({
...
@@ -414,6 +414,17 @@ export const getCostSummaryListApi = (params = {}) => request({
params
params
});
});
/**
* 获取全量成本汇总列表
* @param {*} params
* @returns
*/
export
const
getCostSummaryAllListApi
=
(
params
=
{})
=>
request
({
url
:
"/cbSummary/allList"
,
method
:
"get"
,
params
});
/**
/**
* 锁定成本前提示未填项
* 锁定成本前提示未填项
* @param {*} params
* @param {*} params
...
@@ -459,3 +470,14 @@ export const exportCostLockExcelApi = (data = {}) => request({
...
@@ -459,3 +470,14 @@ export const exportCostLockExcelApi = (data = {}) => request({
isFile
:
true
,
isFile
:
true
,
responseType
:
"blob"
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";
...
@@ -6,13 +6,13 @@ import Decimal from "decimal.js";
* @param {*} num2
* @param {*} num2
* @returns
* @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"
);
const
flag
=
(
!
parseFloat
(
num1
)
&&
parseFloat
(
num1
)
!=
"0"
)
||
(
!
parseFloat
(
num2
)
&&
parseFloat
(
num2
)
!=
"0"
);
if
(
flag
)
throw
new
Error
(
"传入参数错误,参数不为number"
);
if
(
flag
)
throw
new
Error
(
"传入参数错误,参数不为number"
);
const
decimal1
=
new
Decimal
(
num1
);
const
decimal1
=
new
Decimal
(
num1
);
const
decimal2
=
new
Decimal
(
num2
);
const
decimal2
=
new
Decimal
(
num2
);
const
result
=
decimal1
.
plus
(
decimal2
);
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) => {
...
@@ -21,13 +21,13 @@ export const add = (num1, num2, digit = 9, omit = false) => {
* @param {*} num2
* @param {*} num2
* @returns
* @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"
);
const
flag
=
(
!
parseFloat
(
num1
)
&&
parseFloat
(
num1
)
!=
"0"
)
||
(
!
parseFloat
(
num2
)
&&
parseFloat
(
num2
)
!=
"0"
);
if
(
flag
)
throw
new
Error
(
"传入参数错误,参数不为number"
);
if
(
flag
)
throw
new
Error
(
"传入参数错误,参数不为number"
);
const
decimal1
=
new
Decimal
(
num1
);
const
decimal1
=
new
Decimal
(
num1
);
const
decimal2
=
new
Decimal
(
num2
);
const
decimal2
=
new
Decimal
(
num2
);
const
result
=
decimal1
.
minus
(
decimal2
);
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) => {
...
@@ -36,13 +36,13 @@ export const subtract = (num1, num2, digit = 9, omit = false) => {
* @param {*} num2
* @param {*} num2
* @returns
* @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"
);
const
flag
=
(
!
parseFloat
(
num1
)
&&
parseFloat
(
num1
)
!=
"0"
)
||
(
!
parseFloat
(
num2
)
&&
parseFloat
(
num2
)
!=
"0"
);
if
(
flag
)
throw
new
Error
(
"传入参数错误,参数不为number"
);
if
(
flag
)
throw
new
Error
(
"传入参数错误,参数不为number"
);
const
decimal1
=
new
Decimal
(
num1
);
const
decimal1
=
new
Decimal
(
num1
);
const
decimal2
=
new
Decimal
(
num2
);
const
decimal2
=
new
Decimal
(
num2
);
const
result
=
decimal1
.
times
(
decimal2
);
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) => {
...
@@ -51,13 +51,13 @@ export const multiply = (num1, num2, digit = 9, omit = false) => {
* @param {*} num2
* @param {*} num2
* @returns
* @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"
);
const
flag
=
(
!
parseFloat
(
num1
)
&&
parseFloat
(
num1
)
!=
"0"
)
||
(
!
parseFloat
(
num2
)
&&
parseFloat
(
num2
)
!=
"0"
);
if
(
flag
)
throw
new
Error
(
"传入参数错误,参数不为number"
);
if
(
flag
)
throw
new
Error
(
"传入参数错误,参数不为number"
);
const
decimal1
=
new
Decimal
(
num1
);
const
decimal1
=
new
Decimal
(
num1
);
const
decimal2
=
new
Decimal
(
num2
);
const
decimal2
=
new
Decimal
(
num2
);
const
result
=
decimal1
.
dividedBy
(
decimal2
);
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
...
@@ -31,7 +31,8 @@
...
@@ -31,7 +31,8 @@
<div
class=
"lock-cost-btn"
:class=
"{'current-month-lock' : currentMonthLock}"
@
click=
"!currentMonthLock ? lockCostHandler() : ''"
>
锁定成本
<div
class=
"lock-cost-btn"
:class=
"{'current-month-lock' : currentMonthLock}"
@
click=
"!currentMonthLock ? lockCostHandler() : ''"
>
锁定成本
</div>
</div>
<div
class=
"export-excel-btn"
@
click=
"exportExcel"
>
导出Excel表
</div>
<div
class=
"export-excel-btn"
@
click=
"exportExcel"
>
导出Excel表
</div>
<div
class=
"edit-cost-btn"
>
{{addActualCostEditStatus ? "保存成本" : "编辑成本"}}
</div>
<div
class=
"edit-cost-btn"
@
click=
"addActualCostEditStatus ? saveCostModify() : editCost()"
>
{{addActualCostEditStatus ? "保存成本" : "编辑成本"}}
</div>
</div>
</div>
</div>
</div>
<!-- 数据列表部分 -->
<!-- 数据列表部分 -->
...
@@ -39,8 +40,24 @@
...
@@ -39,8 +40,24 @@
<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=
"costSummaryForm"
: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
ref=
"costSummaryTable"
:tableData=
"dataForm.tableDataList"
:formColum=
"formColum"
:max-height=
"true"
:row-key=
"rowKey"
:lazy=
"true"
:load-fn=
"tableLazyLoad"
:tree-options=
"treeOptions"
:default-expand-all=
"false"
:indent=
"8"
:tableDataTotal=
"total"
:default-expand-all=
"true"
:indent=
"8"
:tableDataTotal=
"total"
:paging=
"false"
:cell-class-name=
"cellClassName"
>
:paging=
"false"
:cell-class-name=
"cellClassName"
>
<!-- 本月费用(含税) -->
<
template
slot=
"taxInclusiveExpense"
slot-scope=
"scope"
>
<!-- 本月费用(含税)编辑单元格 -->
<el-form-item
:prop=
"`tableDataList.$
{getTableTreeProp(dataForm.tableDataList,scope.row.id)}.taxInclusiveExpense`"
:rules="checkRules.amountCheck" v-if="addActualCostEditStatus" class="inner-edit-input-item">
<el-input
placeholder=
"请输入"
v-model=
"scope.row.taxInclusiveExpense"
clearable
@
input=
"v => editIptValueRectify(v,scope.row,'taxInclusiveExpense')"
></el-input>
</el-form-item>
</
template
>
<!-- 本月费用(不含税) -->
<
template
slot=
"taxExclusiveExpense"
slot-scope=
"scope"
>
<el-form-item
:prop=
"`tableDataList.$
{getTableTreeProp(dataForm.tableDataList,scope.row.id)}.taxExclusiveExpense`"
:rules="checkRules.amountCheck" v-if="addActualCostEditStatus" class="inner-edit-input-item">
<el-input
placeholder=
"请输入"
v-model=
"scope.row.taxExclusiveExpense"
clearable
@
input=
"v => editIptValueRectify(v,scope.row,'taxExclusiveExpense')"
></el-input>
</el-form-item>
</
template
>
</custom-table>
</custom-table>
</el-form>
</el-form>
</div>
</div>
...
@@ -51,14 +68,19 @@
...
@@ -51,14 +68,19 @@
<lock-cost-tip
v-model=
"lockCostTipDialog"
:tip-content=
"lockCostTipDialogContent"
@
ok=
"okLock"
<lock-cost-tip
v-model=
"lockCostTipDialog"
:tip-content=
"lockCostTipDialogContent"
@
ok=
"okLock"
@
update:lockCostTipDialog=
"lockCostTipDialogClose"
></lock-cost-tip>
@
update:lockCostTipDialog=
"lockCostTipDialogClose"
></lock-cost-tip>
<!-- 选择编辑的成本月份弹窗 -->
<edit-cost-month-select
v-model=
"editCostMonthSelectDialog"
:project-create-time=
"projectDetailInfo.createTime"
:disable-months=
"disableMonths"
@
timeSelect=
"timeSelect"
@
dialogStatusChange=
"dialogStatusChange"
></edit-cost-month-select>
</div>
</div>
</template>
</template>
<
script
>
<
script
>
import
ProjectSideMenu
from
"@/views/projectCostLedger/detail/components/ProjectSideMenu"
;
import
ProjectSideMenu
from
"@/views/projectCostLedger/detail/components/ProjectSideMenu"
;
import
DskSkeleton
from
"@/components/DskSkeleton"
;
import
DskSkeleton
from
"@/components/DskSkeleton"
;
import
CustomTable
from
"@/components/CustomTable"
;
import
CustomTable
from
"@/components/CustomTable"
;
import
EditCostMonthSelect
from
"@/views/projectCostLedger/detail/components/CostSummary/components/CostMonthSelect"
;
import
LockCostTip
from
"@/views/projectCostLedger/detail/components/CostSummary/components/LockCostTip"
;
import
LockCostTip
from
"@/views/projectCostLedger/detail/components/CostSummary/components/LockCostTip"
;
import
{
getCostSummaryMenuTreeApi
,
getCostSummaryMonthListApi
,
getCostSummary
ListApi
,
validateBeforeCostLockApi
,
getLockMonthListApi
,
setCostLockApi
,
exportCostLockExcel
Api
}
from
"@/api/projectCostLedger"
;
import
{
getCostSummaryMenuTreeApi
,
getCostSummaryMonthListApi
,
getCostSummary
AllListApi
,
validateBeforeCostLockApi
,
getLockMonthListApi
,
setCostLockApi
,
exportCostLockExcelApi
,
saveCostModify
Api
}
from
"@/api/projectCostLedger"
;
import
{
v4
}
from
'uuid'
;
import
{
v4
}
from
'uuid'
;
import
dayjs
from
"dayjs"
;
import
dayjs
from
"dayjs"
;
import
{
cloneDeep
}
from
"lodash-es"
;
import
{
cloneDeep
}
from
"lodash-es"
;
...
@@ -108,9 +130,18 @@ export default {
...
@@ -108,9 +130,18 @@ export default {
ProjectSideMenu
,
ProjectSideMenu
,
DskSkeleton
,
DskSkeleton
,
CustomTable
,
CustomTable
,
LockCostTip
LockCostTip
,
EditCostMonthSelect
},
},
data
()
{
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
{
return
{
// 当前分类 1 按项目汇总 2 成本汇总
// 当前分类 1 按项目汇总 2 成本汇总
currentCategory
:
1
,
currentCategory
:
1
,
...
@@ -144,8 +175,8 @@ export default {
...
@@ -144,8 +175,8 @@ export default {
{
label
:
'成本占比'
,
prop
:
"cbProportion"
,
width
:
"182"
,
uid
:
v4
()
},
{
label
:
'成本占比'
,
prop
:
"cbProportion"
,
width
:
"182"
,
uid
:
v4
()
},
{
label
:
'含税成本平米指标'
,
prop
:
"taxInclusivePmTarget"
,
width
:
"182"
,
uid
:
v4
()
},
{
label
:
'含税成本平米指标'
,
prop
:
"taxInclusivePmTarget"
,
width
:
"182"
,
uid
:
v4
()
},
{
label
:
'备注'
,
prop
:
"remark"
,
width
:
"182"
,
uid
:
v4
()
},
{
label
:
'备注'
,
prop
:
"remark"
,
width
:
"182"
,
uid
:
v4
()
},
{
label
:
'本月费用(含税)'
,
prop
:
"taxInclusiveExpense"
,
width
:
"182"
,
uid
:
v4
()
},
{
label
:
'本月费用(含税)'
,
prop
:
"taxInclusiveExpense"
,
width
:
"182"
,
uid
:
v4
()
,
slot
:
true
},
{
label
:
'本月费用(不含税)'
,
prop
:
"taxExclusiveExpense"
,
width
:
"182"
,
uid
:
v4
()
},
{
label
:
'本月费用(不含税)'
,
prop
:
"taxExclusiveExpense"
,
width
:
"182"
,
uid
:
v4
()
,
slot
:
true
},
{
label
:
'截止本月费用(含税)'
,
prop
:
"taxInclusiveExpenseTotal"
,
width
:
"182"
,
uid
:
v4
()
},
{
label
:
'截止本月费用(含税)'
,
prop
:
"taxInclusiveExpenseTotal"
,
width
:
"182"
,
uid
:
v4
()
},
{
label
:
'截止本月费用(不含税)'
,
prop
:
"taxExclusiveExpenseTotal"
,
width
:
"182"
,
uid
:
v4
()
},
{
label
:
'截止本月费用(不含税)'
,
prop
:
"taxExclusiveExpenseTotal"
,
width
:
"182"
,
uid
:
v4
()
},
],
],
...
@@ -156,10 +187,6 @@ export default {
...
@@ -156,10 +187,6 @@ export default {
lockMonthList
:
[],
lockMonthList
:
[],
rowKey
:
"id"
,
rowKey
:
"id"
,
// 列表懒加载配置
// 列表懒加载配置
treeOptions
:
{
children
:
"children"
,
hasChildren
:
"hasChildren"
},
dataForm
:
{
dataForm
:
{
// 数据列表源数据
// 数据列表源数据
tableDataList
:
[],
tableDataList
:
[],
...
@@ -169,13 +196,11 @@ export default {
...
@@ -169,13 +196,11 @@ export default {
// 历史查询月份
// 历史查询月份
oldExpenseDate
:
""
,
oldExpenseDate
:
""
,
// 当前选中子菜单的父类名称
// 当前选中子菜单的父类名称
currentParent
Name
:
""
,
currentParent
Id
:
""
,
// 当前选中的成本科目
// 当前选中的成本科目
currentNodeValue
:
""
,
currentNodeValue
:
""
,
// 源数据列表
// 源数据列表
originTableDataList
:
[],
originTableDataList
:
[],
// 填写成本弹窗
showAddActualCost
:
false
,
// 填写成本 编辑状态
// 填写成本 编辑状态
addActualCostEditStatus
:
false
,
addActualCostEditStatus
:
false
,
// 当前选择的成本年份
// 当前选择的成本年份
...
@@ -184,6 +209,16 @@ export default {
...
@@ -184,6 +209,16 @@ export default {
lockCostTipDialog
:
false
,
lockCostTipDialog
:
false
,
// 锁定成本前提示弹窗文本内容
// 锁定成本前提示弹窗文本内容
lockCostTipDialogContent
:
""
,
lockCostTipDialogContent
:
""
,
// 编辑成本选择月份弹窗
editCostMonthSelectDialog
:
false
,
// 被锁定的成本月份
disableMonths
:
[],
// 编辑数据验证规则
checkRules
:
{
amountCheck
:
[
{
trigger
:
[
"change"
],
validator
:
amountCheckValidator
}
]
},
};
};
},
},
//可访问data属性
//可访问data属性
...
@@ -218,9 +253,13 @@ export default {
...
@@ -218,9 +253,13 @@ export default {
includeNowMonth
(
time
)
{
includeNowMonth
(
time
)
{
return
this
.
originMonthList
.
includes
(
time
);
return
this
.
originMonthList
.
includes
(
time
);
},
},
// 按项目汇总 按成本科目汇总
currentCategoryChange
(
category
)
{
currentCategoryChange
(
category
)
{
if
(
category
==
this
.
currentCategory
)
return
;
if
(
category
==
this
.
currentCategory
)
return
;
this
.
currentCategory
=
category
;
this
.
currentCategory
=
category
;
this
.
resetEditStatus
();
this
.
tableLoading
=
true
;
this
.
init
(
this
.
comProjectDetailInfo
);
},
},
async
init
(
detail
=
{},
resetDate
=
""
)
{
async
init
(
detail
=
{},
resetDate
=
""
)
{
try
{
try
{
...
@@ -251,8 +290,8 @@ export default {
...
@@ -251,8 +290,8 @@ export default {
// 默认选中结构劳务分包
// 默认选中结构劳务分包
if
(
defaultCurrent
)
{
if
(
defaultCurrent
)
{
this
.
currentNodeValue
=
defaultCurrent
.
nodeValue
;
this
.
currentNodeValue
=
defaultCurrent
.
nodeValue
;
const
parent
Name
=
defaultCurrent
.
parent
?
this
.
getCurrentType
(
defaultCurrent
.
parent
)
:
defaultCurrent
.
nodeName
;
const
parent
Id
=
defaultCurrent
.
parent
?
this
.
getCurrentType
(
defaultCurrent
.
parent
)
:
defaultCurrent
.
nodeName
;
if
(
parent
Name
)
this
.
currentParentName
=
parentName
;
if
(
parent
Id
)
this
.
currentParentId
=
parentId
;
const
params
=
this
.
createRequestConditions
(
resetDate
);
const
params
=
this
.
createRequestConditions
(
resetDate
);
await
this
.
getCostSummaryList
(
params
);
await
this
.
getCostSummaryList
(
params
);
}
}
...
@@ -262,7 +301,7 @@ export default {
...
@@ -262,7 +301,7 @@ export default {
},
},
getCurrentType
(
parent
)
{
getCurrentType
(
parent
)
{
if
(
parent
.
level
==
2
)
{
if
(
parent
.
level
==
2
)
{
return
parent
.
node
Nam
e
;
return
parent
.
node
Valu
e
;
}
}
if
(
parent
.
parent
)
{
if
(
parent
.
parent
)
{
return
this
.
getCurrentType
(
parent
.
parent
);
return
this
.
getCurrentType
(
parent
.
parent
);
...
@@ -322,8 +361,9 @@ export default {
...
@@ -322,8 +361,9 @@ export default {
// 默认以当前月数据为准 若不包含当前月 需要手动push数据
// 默认以当前月数据为准 若不包含当前月 需要手动push数据
if
(
!
data
.
includes
(
_now
))
{
if
(
!
data
.
includes
(
_now
))
{
data
.
push
({
data
.
push
({
label
:
dayjs
(
_now
).
format
(
"YYYY年MM月"
),
expenseDate
:
_now
,
expenseDate
:
_now
,
isLock
:
0
isLock
:
0
,
});
});
}
}
// 年月排序
// 年月排序
...
@@ -381,44 +421,44 @@ export default {
...
@@ -381,44 +421,44 @@ export default {
async
getCostSummaryList
(
params
=
{})
{
async
getCostSummaryList
(
params
=
{})
{
try
{
try
{
this
.
tableLoading
=
true
;
this
.
tableLoading
=
true
;
const
list
=
await
getCostSummaryListApi
(
params
);
const
list
=
await
getCostSummary
All
ListApi
(
params
);
if
(
list
.
code
==
200
&&
list
.
data
instanceof
Array
)
{
if
(
list
.
code
==
200
&&
list
.
data
instanceof
Array
)
{
let
_temp
=
list
.
data
;
let
_temp
=
list
.
data
;
const
_mapList
=
new
Map
();
//! 注释代码 皆为 懒加载情况下处理逻辑
//
如果有长度循环处理字段
//
const _mapList = new Map();
if
(
_temp
.
length
)
{
// // 如果有长度循环处理字段
_temp
=
_temp
.
map
(
item
=>
{
// if (_temp.length)
{
if
(
!
item
.
hasChildren
)
{
// _temp = _temp.map(item =>
{
item
.
hasChildren
=
false
;
// if (!item.hasChildren) {
}
else
{
// item.hasChildren = false;
// 有children
// } else {
item
.
hasChildren
=
true
;
// // 有children
if
(
item
?.
children
?.
length
)
{
// item.hasChildren = true;
item
.
children
=
item
.
children
.
map
(
childItem
=>
{
// if (item?.children?.length)
{
childItem
.
hasChildren
=
childItem
.
hasChildren
?
true
:
false
;
// item.children = item.children.map(childItem => {
return
childItem
;
// childItem.hasChildren = childItem.hasChildren ? true : false
;
})
;
// return childItem
;
}
// });
};
// }
// 储存将子级储存到map 主动调用展开菜单
// };
item
.
hasChildren
?
_mapList
.
set
(
item
.
id
,
item
.
children
?
cloneDeep
(
item
.
children
)
:
[])
:
null
;
// // 储存将子级储存到map 主动调用展开菜单
delete
item
.
children
;
// item.hasChildren ? _mapList.set(item.id, item.children ? cloneDeep(item.children) : []) : null
;
return
item
;
// 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
;
this
.
tableLoading
=
false
;
await
this
.
$nextTick
();
//
await this.$nextTick();
const
tableIns
=
this
.
$refs
[
"costSummaryTable"
].
$refs
[
"customTableRef"
];
//
const tableIns = this.$refs["costSummaryTable"].$refs["customTableRef"];
if
(
tableIns
)
{
//
if (tableIns) {
_mapList
.
forEach
((
child
,
id
)
=>
{
//
_mapList.forEach((child, id) => {
// 打开一级目录
//
// 打开一级目录
this
.
customResolve
(
id
,
child
,
tableIns
);
//
this.customResolve(id, child, tableIns);
});
//
});
}
//
}
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
this
.
tableLoading
=
false
;
this
.
tableLoading
=
false
;
...
@@ -491,6 +531,7 @@ export default {
...
@@ -491,6 +531,7 @@ export default {
resetEditStatus
()
{
resetEditStatus
()
{
// 当前需要编辑或者新增的成本年份
// 当前需要编辑或者新增的成本年份
const
_selectActualCostTime
=
this
.
selectActualCostTime
;
const
_selectActualCostTime
=
this
.
selectActualCostTime
;
this
.
editCostMonthSelectDialog
=
false
;
this
.
addActualCostEditStatus
=
false
;
this
.
addActualCostEditStatus
=
false
;
this
.
selectActualCostTime
=
""
;
this
.
selectActualCostTime
=
""
;
/**
/**
...
@@ -499,7 +540,7 @@ export default {
...
@@ -499,7 +540,7 @@ export default {
*/
*/
if
(
!
_selectActualCostTime
)
return
;
if
(
!
_selectActualCostTime
)
return
;
if
(
!
this
.
originMonthList
.
includes
(
_selectActualCostTime
)
&&
_selectActualCostTime
!=
this
.
getNowMonth
())
{
if
(
!
this
.
originMonthList
.
includes
(
_selectActualCostTime
)
&&
_selectActualCostTime
!=
this
.
getNowMonth
())
{
const
index
=
this
.
monthList
.
findIndex
(
item
=>
item
.
valu
e
==
_selectActualCostTime
);
const
index
=
this
.
monthList
.
findIndex
(
item
=>
item
.
expenseDat
e
==
_selectActualCostTime
);
if
(
index
!=
-
1
)
{
if
(
index
!=
-
1
)
{
this
.
monthList
.
splice
(
index
,
1
);
this
.
monthList
.
splice
(
index
,
1
);
this
.
expenseDate
=
this
.
getNowMonth
();
this
.
expenseDate
=
this
.
getNowMonth
();
...
@@ -509,8 +550,8 @@ export default {
...
@@ -509,8 +550,8 @@ export default {
async
menuSelect
(
currentId
,
currentTemp
)
{
async
menuSelect
(
currentId
,
currentTemp
)
{
this
.
resetEditStatus
();
this
.
resetEditStatus
();
this
.
currentNodeValue
=
currentId
;
this
.
currentNodeValue
=
currentId
;
const
parent
Name
=
currentTemp
.
parent
?
this
.
getCurrentType
(
currentTemp
.
parent
)
:
currentId
;
const
parent
Id
=
currentTemp
.
parent
?
this
.
getCurrentType
(
currentTemp
.
parent
)
:
currentId
;
if
(
parent
Name
)
this
.
currentParentName
=
parentName
;
if
(
parent
Id
)
this
.
currentParentId
=
parentId
;
const
params
=
this
.
createRequestConditions
(
this
.
expenseDate
);
const
params
=
this
.
createRequestConditions
(
this
.
expenseDate
);
this
.
getCostSummaryList
(
params
);
this
.
getCostSummaryList
(
params
);
},
},
...
@@ -576,8 +617,93 @@ export default {
...
@@ -576,8 +617,93 @@ export default {
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
);
console
.
log
(
error
);
}
}
},
// 编辑成本
editCost
()
{
// const _disableMonths = this.monthList.filter(item => item.isLock == true).map(item => item.expenseDate);
const
_disableMonths
=
cloneDeep
(
this
.
lockMonthList
);
this
.
disableMonths
=
_disableMonths
;
this
.
editCostMonthSelectDialog
=
true
;
},
dialogStatusChange
(
flag
)
{
this
.
editCostMonthSelectDialog
=
false
;
// 重置禁用
this
.
disableMonths
=
[];
},
//成本月选择回调
async
timeSelect
(
selectTime
)
{
// 编辑状态
this
.
addActualCostEditStatus
=
true
;
this
.
selectActualCostTime
=
selectTime
;
// 判断是否包含 选择的年月 包含则修改 未包含则新增
const
findReslut
=
this
.
originMonthList
.
includes
(
selectTime
)
||
this
.
monthList
.
find
(
item
=>
item
.
value
==
selectTime
);
const
params
=
this
.
createRequestConditions
();
if
(
!
findReslut
)
{
// 不包含当前所选月 新增数据
let
_temp
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
monthList
));
_temp
.
push
({
label
:
dayjs
(
selectTime
).
format
(
"YYYY年MM月"
),
expenseDate
:
selectTime
,
isLock
:
0
});
_temp
=
this
.
monthsSort
(
_temp
);
// console.log(_temp);
this
.
monthList
=
_temp
;
}
this
.
expenseDate
=
selectTime
;
params
[
"expenseDate"
]
=
selectTime
;
// 获取选中月数据
await
this
.
getCostSummaryList
(
params
);
// 将编辑区域移动到视口
await
this
.
$nextTick
();
await
this
.
editRegionToViewPort
();
},
// 将编辑区域移动到视口
async
editRegionToViewPort
()
{
// 获取编辑列所处位置
const
container
=
document
.
querySelector
(
".el-table__body-wrapper"
);
/**
* @type {HTMLTableCellElement}
*/
const
editElement
=
container
.
querySelector
(
".el-table__row [class *= can-edit-column-]"
);
if
(
editElement
)
{
const
left
=
editElement
.
offsetLeft
;
container
.
scrollTo
({
behavior
:
"smooth"
,
left
,
top
:
0
});
}
},
// 成本输入数据限制
editIptValueRectify
(
value
,
row
,
prop
)
{
const
reg
=
/^
(?!
0
\d)(?!
0+$
)(?!
0*
\.
0*$
)\d
+
(\.\d
+
)?
$/
;
if
(
reg
.
test
(
value
))
{
row
[
prop
]
=
add
(
0
,
value
);
}
}
},
},
//保存成本
saveCostModify
()
{
},
// 获取当前树形结构下 输入框prop的完整路径
getTableTreeProp
(
dataList
=
[],
rowId
,
pathArray
=
[])
{
const
len
=
dataList
.
length
;
for
(
let
index
=
0
;
index
<
len
;
index
++
)
{
const
item
=
dataList
[
index
];
// 返回所在下标index
if
(
item
.
id
===
rowId
)
{
pathArray
.
push
(
index
);
break
;
}
if
(
item
?.
children
?.
length
)
{
this
.
getTableTreeProp
(
item
.
children
,
rowId
,
[
`
${
index
}
.children.`
]);
}
}
console
.
log
(
pathArray
);
return
pathArray
.
join
(
""
);
},
},
}
}
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
...
...
dsk-operate-ui/src/views/projectCostLedger/detail/components/FeedSummary/index.vue
View file @
b25928a8
...
@@ -51,7 +51,8 @@
...
@@ -51,7 +51,8 @@
<!-- 编辑单元格 -->
<!-- 编辑单元格 -->
<el-form-item
:prop=
"`tableDataList.$
{scope.rowIndex}.quantities`" :rules="checkRules.amountCheck"
<el-form-item
:prop=
"`tableDataList.$
{scope.rowIndex}.quantities`" :rules="checkRules.amountCheck"
v-if="rowCanEditInput(scope.rowIndex,hasTarget)
&&
addActualCostEditStatus" class="inner-edit-input-item">
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>
</el-form-item>
</
template
>
</
template
>
<!-- 本月采购单价 -->
<!-- 本月采购单价 -->
...
@@ -60,7 +61,7 @@
...
@@ -60,7 +61,7 @@
<el-form-item
:prop=
"`tableDataList.$
{scope.rowIndex}.purchaseUnitPrice`" :rules="checkRules.amountCheck"
<el-form-item
:prop=
"`tableDataList.$
{scope.rowIndex}.purchaseUnitPrice`" :rules="checkRules.amountCheck"
v-if="rowCanEditInput(scope.rowIndex,hasTarget)
&&
addActualCostEditStatus" class="inner-edit-input-item">
v-if="rowCanEditInput(scope.rowIndex,hasTarget)
&&
addActualCostEditStatus" class="inner-edit-input-item">
<el-input
placeholder=
"请输入"
v-model=
"scope.row.purchaseUnitPrice"
clearable
<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>
</el-form-item>
</
template
>
</
template
>
</custom-table>
</custom-table>
...
@@ -595,8 +596,12 @@ export default {
...
@@ -595,8 +596,12 @@ export default {
this
.
statisticsTimer
=
null
;
this
.
statisticsTimer
=
null
;
},
},
// 实时统计
// 实时统计
statisticsSum
(
value
,
prop
)
{
statisticsSum
(
value
,
prop
,
row
)
{
this
.
clearStatisticsTimer
();
this
.
clearStatisticsTimer
();
const
reg
=
/^
(?!
0
\d)(?!
0+$
)(?!
0*
\.
0*$
)\d
+
(\.\d
+
)?
$/
;
if
(
reg
.
test
(
value
))
{
row
[
prop
]
=
add
(
0
,
value
);
}
// 填写一秒后触发
// 填写一秒后触发
this
.
statisticsTimer
=
setTimeout
(()
=>
{
this
.
statisticsTimer
=
setTimeout
(()
=>
{
const
sum
=
this
.
sumHandler
(
this
.
dataForm
.
tableDataList
,
prop
,
this
.
hasTarget
);
const
sum
=
this
.
sumHandler
(
this
.
dataForm
.
tableDataList
,
prop
,
this
.
hasTarget
);
...
@@ -651,6 +656,7 @@ export default {
...
@@ -651,6 +656,7 @@ export default {
if
(
result
.
code
==
200
)
{
if
(
result
.
code
==
200
)
{
this
.
$message
.
success
(
"保存成功"
);
this
.
$message
.
success
(
"保存成功"
);
await
this
.
init
(
this
.
comProjectDetailInfo
,
this
.
selectActualCostTime
);
await
this
.
init
(
this
.
comProjectDetailInfo
,
this
.
selectActualCostTime
);
await
this
.
$nextTick
();
await
this
.
editRegionToViewPort
();
await
this
.
editRegionToViewPort
();
}
}
}
}
...
@@ -741,10 +747,10 @@ export default {
...
@@ -741,10 +747,10 @@ export default {
// 获取选中月数据
// 获取选中月数据
await
this
.
getFeedSummaryList
(
params
);
await
this
.
getFeedSummaryList
(
params
);
// 将编辑区域移动到视口
// 将编辑区域移动到视口
await
this
.
$nextTick
();
await
this
.
editRegionToViewPort
();
await
this
.
editRegionToViewPort
();
},
},
async
editRegionToViewPort
()
{
async
editRegionToViewPort
()
{
await
this
.
$nextTick
();
// 获取编辑列所处位置
// 获取编辑列所处位置
const
container
=
document
.
querySelector
(
".el-table__body-wrapper"
);
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