Commit bf9f43a5 by 孙美琪

修改

parent 8abd9256
......@@ -15,7 +15,7 @@
<div class="page-main">
<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 label="资源型号" prop="model"/>
<el-table-column label="配置详情" width="150px">
......@@ -27,14 +27,20 @@
</template>
</el-table-column>
<el-table-column v-for="(item,index) in params[0]" :key="item.id" :label="item.name"
:width="item?.name?.length >= 8 ? '150px':''">
<template #default="scope">
{{ params[scope.$index][index]['valueName'] }}
<!-- <el-table-column v-for="(item,index) in params[0]" :key="item.id" :label="item.name"-->
<!-- :width="item?.name?.length >= 8 ? '150px':''">-->
<!-- <template #default="scope">-->
<!-- {{ 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>
</el-table-column>
<el-table-column label="申请数量" prop="useNum">
<el-table-column label="申请数量" prop="useNum" width="95px">
<template #default="{row}">
<el-input-number
v-model="row.useNum"
......@@ -62,6 +68,9 @@
v-model:page="pageNum"
v-model:limit="pageSize"
@pagination="getList"/>
<div v-if="tableData.length === 0" class="empty-box">
<el-empty description="暂无数据"/>
</div>
</div>
</div>
......@@ -102,9 +111,9 @@ import {
shoppingSubmit,
shoppingComputerVo
} from '@/api/computingResource.js'
import { ref, computed } from 'vue'
import { ElMessageBox } from 'element-plus'
import { useRouter } from 'vue-router'
import {ref, computed} from 'vue'
import {ElMessageBox} from 'element-plus'
import {useRouter} from 'vue-router'
const router = useRouter()
......@@ -115,26 +124,44 @@ const tableData = ref([])
const params = ref([])
function getList () {
function getList() {
shoppingList({pageNum: pageNum.value, pageSize: pageSize.value}).then(res => {
console.log(res)
tableData.value = res.rows
total.value = res.total
params.value = res.rows.map(item => {
return JSON.parse(item.param)
})
})
}
const handler = {
get(target, propKey) {
return target[propKey];
}
};
getList()
const ids = ref([])
function tableSelectionChange (value) {
function tableSelectionChange(value) {
ids.value = value.map(row => row.id)
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 list = tableData.value.filter(item => {
// return ids.value.includes(item.id)
......@@ -144,7 +171,7 @@ function tableSelectionChange (value) {
// return price
// })
function editNum (row) {
function editNum(row) {
shoppingEdit({id: row.id, useNum: row.useNum}).then(res => {
shoppingComputer()
getList()
......@@ -153,7 +180,7 @@ function editNum (row) {
const totalPrice = ref(0)
function shoppingComputer () {
function shoppingComputer() {
if (!ids.value.length) {
totalPrice.value = 0
return
......@@ -164,16 +191,15 @@ function shoppingComputer () {
}
function confirmDel (row) {
function confirmDel(row) {
const idsValue = row?.id ? row.id : ids.value
shoppingDelete(idsValue).then(res => {
getList()
})
console.log(row)
}
function submit () {
function submit() {
ElMessageBox.confirm(
'确认提交订单吗',
'提示',
......@@ -219,7 +245,7 @@ function submit () {
.page-title {
font-weight: bold;
font-size: 24px;
font-size: 22px;
color: #303233;
padding: 12px 80px;
background-color: #FFFFFF;
......@@ -278,6 +304,13 @@ function submit () {
}
.empty-box {
display: flex;
justify-content: center;
align-items: center;
min-height: 650px;
}
.footer-bar {
padding: 18px;
background-color: #FFFFFF;
......
......@@ -134,7 +134,7 @@
<!-- </el-icon>-->
<!-- </el-button>-->
<!-- </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>
<img class="block-light" src="@/assets/images/indexImg/glow5.png" alt=""/>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment