Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
client
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
bf9f43a5
authored
Jun 21, 2024
by
孙美琪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
8abd9256
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
22 deletions
+55
-22
src/views/computingResource/shoppingCart.vue
+54
-21
src/views/index-copy.vue
+1
-1
No files found.
src/views/computingResource/shoppingCart.vue
View file @
bf9f43a5
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
<div
class=
"page-main"
>
<div
class=
"page-main"
>
<div
class=
"detail-info"
>
<div
class=
"detail-info"
>
<el-table
:data=
"tableData"
row-key=
"id"
@
selection-change=
"tableSelectionChange"
>
<el-table
:data=
"tableData"
v-if=
"tableData.length !== 0"
row-key=
"id"
@
selection-change=
"tableSelectionChange"
>
<el-table-column
type=
"selection"
reserve-selection
/>
<el-table-column
type=
"selection"
reserve-selection
/>
<el-table-column
label=
"资源型号"
prop=
"model"
/>
<el-table-column
label=
"资源型号"
prop=
"model"
/>
<el-table-column
label=
"配置详情"
width=
"150px"
>
<el-table-column
label=
"配置详情"
width=
"150px"
>
...
@@ -27,14 +27,20 @@
...
@@ -27,14 +27,20 @@
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
v-for=
"(item,index) in params[0]"
:key=
"item.id"
:label=
"item.name"
<!-- <el-table-column v-for="(item,index) in params[0]" :key="item.id" :label="item.name"-->
:width=
"item?.name?.length >= 8 ? '150px':''"
>
<!-- :width="item?.name?.length >= 8 ? '150px':''">-->
<
template
#
default=
"scope"
>
<!-- <template #default="scope">-->
{{
params
[
scope
.
$index
][
index
][
'valueName'
]
}}
<!-- {{ param[scope.$index][index]['valueName'] }}-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column
v-for=
"(i, index) in headers"
:key=
"index"
:label=
"i.name"
:prop=
"i.name"
:width=
"i?.name?.length >= 8 ? '150px':''"
>
<
template
v-slot=
"scope"
>
{{
getCellValue
(
scope
.
row
.
param
,
i
.
name
)
||
'-'
}}
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
label=
"申请数量"
prop=
"useNum"
>
<el-table-column
label=
"申请数量"
prop=
"useNum"
width=
"95px"
>
<
template
#
default=
"{row}"
>
<
template
#
default=
"{row}"
>
<el-input-number
<el-input-number
v-model=
"row.useNum"
v-model=
"row.useNum"
...
@@ -62,6 +68,9 @@
...
@@ -62,6 +68,9 @@
v-model:page=
"pageNum"
v-model:page=
"pageNum"
v-model:limit=
"pageSize"
v-model:limit=
"pageSize"
@
pagination=
"getList"
/>
@
pagination=
"getList"
/>
<div
v-if=
"tableData.length === 0"
class=
"empty-box"
>
<el-empty
description=
"暂无数据"
/>
</div>
</div>
</div>
</div>
</div>
...
@@ -102,9 +111,9 @@ import {
...
@@ -102,9 +111,9 @@ import {
shoppingSubmit
,
shoppingSubmit
,
shoppingComputerVo
shoppingComputerVo
}
from
'@/api/computingResource.js'
}
from
'@/api/computingResource.js'
import
{
ref
,
computed
}
from
'vue'
import
{
ref
,
computed
}
from
'vue'
import
{
ElMessageBox
}
from
'element-plus'
import
{
ElMessageBox
}
from
'element-plus'
import
{
useRouter
}
from
'vue-router'
import
{
useRouter
}
from
'vue-router'
const
router
=
useRouter
()
const
router
=
useRouter
()
...
@@ -115,26 +124,44 @@ const tableData = ref([])
...
@@ -115,26 +124,44 @@ const tableData = ref([])
const
params
=
ref
([])
const
params
=
ref
([])
function
getList
()
{
function
getList
()
{
shoppingList
({
pageNum
:
pageNum
.
value
,
pageSize
:
pageSize
.
value
}).
then
(
res
=>
{
shoppingList
({
pageNum
:
pageNum
.
value
,
pageSize
:
pageSize
.
value
}).
then
(
res
=>
{
console
.
log
(
res
)
tableData
.
value
=
res
.
rows
tableData
.
value
=
res
.
rows
total
.
value
=
res
.
total
total
.
value
=
res
.
total
params
.
value
=
res
.
rows
.
map
(
item
=>
{
return
JSON
.
parse
(
item
.
param
)
})
})
})
}
}
const
handler
=
{
get
(
target
,
propKey
)
{
return
target
[
propKey
];
}
};
getList
()
getList
()
const
ids
=
ref
([])
const
ids
=
ref
([])
function
tableSelectionChange
(
value
)
{
function
tableSelectionChange
(
value
)
{
ids
.
value
=
value
.
map
(
row
=>
row
.
id
)
ids
.
value
=
value
.
map
(
row
=>
row
.
id
)
shoppingComputer
()
shoppingComputer
()
}
}
const
headers
=
computed
(()
=>
{
if
(
tableData
.
value
.
length
>
0
&&
tableData
.
value
[
0
].
param
)
{
const
param
=
JSON
.
parse
(
tableData
.
value
[
0
].
param
)
return
param
.
map
(
item
=>
({
name
:
item
.
name
}));
}
return
[];
});
const
getCellValue
=
(
params
,
headerName
)
=>
{
const
paramsCopy
=
JSON
.
parse
(
params
)
const
param
=
paramsCopy
.
find
(
item
=>
item
.
name
===
headerName
);
return
param
?
param
.
valueName
:
''
;
};
// const totalPrice = computed(() => {
// const totalPrice = computed(() => {
// const list = tableData.value.filter(item => {
// const list = tableData.value.filter(item => {
// return ids.value.includes(item.id)
// return ids.value.includes(item.id)
...
@@ -144,7 +171,7 @@ function tableSelectionChange (value) {
...
@@ -144,7 +171,7 @@ function tableSelectionChange (value) {
// return price
// return price
// })
// })
function
editNum
(
row
)
{
function
editNum
(
row
)
{
shoppingEdit
({
id
:
row
.
id
,
useNum
:
row
.
useNum
}).
then
(
res
=>
{
shoppingEdit
({
id
:
row
.
id
,
useNum
:
row
.
useNum
}).
then
(
res
=>
{
shoppingComputer
()
shoppingComputer
()
getList
()
getList
()
...
@@ -153,7 +180,7 @@ function editNum (row) {
...
@@ -153,7 +180,7 @@ function editNum (row) {
const
totalPrice
=
ref
(
0
)
const
totalPrice
=
ref
(
0
)
function
shoppingComputer
()
{
function
shoppingComputer
()
{
if
(
!
ids
.
value
.
length
)
{
if
(
!
ids
.
value
.
length
)
{
totalPrice
.
value
=
0
totalPrice
.
value
=
0
return
return
...
@@ -164,16 +191,15 @@ function shoppingComputer () {
...
@@ -164,16 +191,15 @@ function shoppingComputer () {
}
}
function
confirmDel
(
row
)
{
function
confirmDel
(
row
)
{
const
idsValue
=
row
?.
id
?
row
.
id
:
ids
.
value
const
idsValue
=
row
?.
id
?
row
.
id
:
ids
.
value
shoppingDelete
(
idsValue
).
then
(
res
=>
{
shoppingDelete
(
idsValue
).
then
(
res
=>
{
getList
()
getList
()
})
})
console
.
log
(
row
)
}
}
function
submit
()
{
function
submit
()
{
ElMessageBox
.
confirm
(
ElMessageBox
.
confirm
(
'确认提交订单吗'
,
'确认提交订单吗'
,
'提示'
,
'提示'
,
...
@@ -219,7 +245,7 @@ function submit () {
...
@@ -219,7 +245,7 @@ function submit () {
.page-title
{
.page-title
{
font-weight
:
bold
;
font-weight
:
bold
;
font-size
:
2
4
px
;
font-size
:
2
2
px
;
color
:
#303233
;
color
:
#303233
;
padding
:
12px
80px
;
padding
:
12px
80px
;
background-color
:
#FFFFFF
;
background-color
:
#FFFFFF
;
...
@@ -278,6 +304,13 @@ function submit () {
...
@@ -278,6 +304,13 @@ function submit () {
}
}
.empty-box
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
min-height
:
650px
;
}
.footer-bar
{
.footer-bar
{
padding
:
18px
;
padding
:
18px
;
background-color
:
#FFFFFF
;
background-color
:
#FFFFFF
;
...
...
src/views/index-copy.vue
View file @
bf9f43a5
...
@@ -134,7 +134,7 @@
...
@@ -134,7 +134,7 @@
<!--
</el-icon>
-->
<!--
</el-icon>
-->
<!--
</el-button>
-->
<!--
</el-button>
-->
<!--
</div>
-->
<!--
</div>
-->
<div
class=
"view-more-text"
style=
"padding-top: 40px;"
>
更多资讯
</div>
<div
class=
"view-more-text"
style=
"padding-top: 40px;"
@
click=
"$router.push('/information/informationList')"
>
更多资讯
</div>
</div>
</div>
<img
class=
"block-light"
src=
"@/assets/images/indexImg/glow5.png"
alt=
""
/>
<img
class=
"block-light"
src=
"@/assets/images/indexImg/glow5.png"
alt=
""
/>
</div>
</div>
...
...
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