|
@@ -7,7 +7,7 @@
|
|
|
|
|
|
import { ref } from 'vue';
|
|
import { ref } from 'vue';
|
|
import { ElCol, ElIcon } from 'element-plus';
|
|
import { ElCol, ElIcon } from 'element-plus';
|
|
-import { EditPen, Picture as IconPicture, Plus, Search } from '@element-plus/icons-vue';
|
|
|
|
|
|
+import { Picture as IconPicture, Plus, Search } from '@element-plus/icons-vue';
|
|
import * as api from '/@/views/computer-information/api';
|
|
import * as api from '/@/views/computer-information/api';
|
|
import { useRouter } from 'vue-router';
|
|
import { useRouter } from 'vue-router';
|
|
import { usePagination } from '/@/utils/usePagination';
|
|
import { usePagination } from '/@/utils/usePagination';
|
|
@@ -20,7 +20,7 @@ const router = useRouter();
|
|
const loading = ref();
|
|
const loading = ref();
|
|
|
|
|
|
const showDialog = ref(false);
|
|
const showDialog = ref(false);
|
|
-const isDrawerVisible = ref(false);
|
|
|
|
|
|
+// const isDrawerVisible = ref(false);
|
|
|
|
|
|
const computerInfo = ref([]);
|
|
const computerInfo = ref([]);
|
|
const shopOptions = ref([]);
|
|
const shopOptions = ref([]);
|
|
@@ -34,12 +34,12 @@ async function fetchCardData() {
|
|
page: tableOptions.value.page,
|
|
page: tableOptions.value.page,
|
|
limit: tableOptions.value.limit,
|
|
limit: tableOptions.value.limit,
|
|
};
|
|
};
|
|
- await useTableData(api.getCardData, query, tableOptions,loading);
|
|
|
|
|
|
+ await useTableData(api.getCardData, query, tableOptions, loading);
|
|
}
|
|
}
|
|
|
|
|
|
// 打开创建弹窗
|
|
// 打开创建弹窗
|
|
async function addComputer() {
|
|
async function addComputer() {
|
|
- showDialog.value = true;
|
|
|
|
|
|
+ showDialog.value = true;
|
|
}
|
|
}
|
|
|
|
|
|
const checkItem = (item) => {
|
|
const checkItem = (item) => {
|
|
@@ -47,18 +47,18 @@ const checkItem = (item) => {
|
|
path: '/computer/detail',
|
|
path: '/computer/detail',
|
|
query: {
|
|
query: {
|
|
id: item.id,
|
|
id: item.id,
|
|
- computerNumber: item.computerNumber,
|
|
|
|
|
|
+ // computerNumber: item.computerNumber,
|
|
},
|
|
},
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
|
|
-async function editItem(item) {
|
|
|
|
- const res = await useResponse(item.id, api.getComputerDetailOverview);
|
|
|
|
- computerInfo.value = res.data;
|
|
|
|
- if (computerInfo.value) {
|
|
|
|
- isDrawerVisible.value = true; // 显示 Drawer
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
|
|
+// async function editItem(item) {
|
|
|
|
+// const res = await useResponse(item.id, api.getComputerDetailOverview);
|
|
|
|
+// computerInfo.value = res.data;
|
|
|
|
+// if (computerInfo.value) {
|
|
|
|
+// isDrawerVisible.value = true; // 显示 Drawer
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
|
|
// 处理图片地址
|
|
// 处理图片地址
|
|
const getImageUrl = (images) => {
|
|
const getImageUrl = (images) => {
|
|
@@ -67,99 +67,114 @@ const getImageUrl = (images) => {
|
|
};
|
|
};
|
|
|
|
|
|
async function fetchShopOptions() {
|
|
async function fetchShopOptions() {
|
|
- try {
|
|
|
|
- const resp = await useResponse(null, api.getShopList);
|
|
|
|
- shopOptions.value = resp.data.map((item: any) => {
|
|
|
|
- return { value: item.id, label: item.platformNumber };
|
|
|
|
- });
|
|
|
|
- } catch (e) {
|
|
|
|
- console.log('error', e);
|
|
|
|
- }
|
|
|
|
|
|
+ try {
|
|
|
|
+ const resp = await useResponse(null, api.getShopList);
|
|
|
|
+ shopOptions.value = resp.data.map((item: any) => {
|
|
|
|
+ return { value: item.id, label: item.platformNumber };
|
|
|
|
+ });
|
|
|
|
+ } catch (e) {
|
|
|
|
+ console.log('error', e);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
async function fetchUserOptions() {
|
|
async function fetchUserOptions() {
|
|
- try {
|
|
|
|
- const resp = await useResponse(null, api.getUserList);
|
|
|
|
- userOptions.value = resp.data.map((item: any) => {
|
|
|
|
- return { value: item.id, label: item.name };
|
|
|
|
- });
|
|
|
|
- } catch (e) {
|
|
|
|
- console.log('error', e);
|
|
|
|
- }
|
|
|
|
|
|
+ try {
|
|
|
|
+ const resp = await useResponse(null, api.getUserList);
|
|
|
|
+ userOptions.value = resp.data.map((item: any) => {
|
|
|
|
+ return { value: item.id, label: item.name };
|
|
|
|
+ });
|
|
|
|
+ } catch (e) {
|
|
|
|
+ console.log('error', e);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
fetchCardData();
|
|
fetchCardData();
|
|
- fetchShopOptions();
|
|
|
|
- fetchUserOptions();
|
|
|
|
|
|
+ fetchShopOptions();
|
|
|
|
+ fetchUserOptions();
|
|
});
|
|
});
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<template>
|
|
<template>
|
|
- <!-- 标题区域 -->
|
|
|
|
- <el-card class="mb-5" style="border: none;">
|
|
|
|
- <div class="flex justify-between items-baseline">
|
|
|
|
- <div>
|
|
|
|
- <span class="font-bold text-xl">电脑信息概览</span>
|
|
|
|
- <el-divider class=" text-3xl" direction="vertical"/>
|
|
|
|
- </div>
|
|
|
|
- <span>
|
|
|
|
- <el-button :icon="Plus" text bg type="primary" @click="addComputer">添 加</el-button>
|
|
|
|
- </span>
|
|
|
|
- </div>
|
|
|
|
- </el-card>
|
|
|
|
|
|
+ <!-- 标题区域 -->
|
|
|
|
+ <el-card class="mb-5" style="border: none">
|
|
|
|
+ <div class="flex justify-between items-baseline">
|
|
|
|
+ <div>
|
|
|
|
+ <span class="font-bold text-xl">电脑信息概览</span>
|
|
|
|
+ <el-divider class="text-3xl" direction="vertical" />
|
|
|
|
+ </div>
|
|
|
|
+ <span>
|
|
|
|
+ <el-button :icon="Plus" bg text type="primary" @click="addComputer">添 加</el-button>
|
|
|
|
+ </span>
|
|
|
|
+ </div>
|
|
|
|
+ </el-card>
|
|
<!-- 卡片展示区域 -->
|
|
<!-- 卡片展示区域 -->
|
|
- <el-card class="mb-5" style="border: none;min-height: 83vh;">
|
|
|
|
- <el-card class="card-container" v-loading="loading" shadow="never" style="border: none;">
|
|
|
|
- <el-row :gutter="20">
|
|
|
|
- <el-col v-for="(item, index) in tableOptions.data" :key="index" :lg="6" :md="8" :sm="8" :xl="4" :xs="12" class="my-2.5">
|
|
|
|
- <el-card class="item-card" shadow="hover">
|
|
|
|
- <el-image :src="getImageUrl(item.images)" alt="电脑图片" class="card-image">
|
|
|
|
- <template #error>
|
|
|
|
- <el-icon class="card-image" style="font-size: 4rem">
|
|
|
|
- <icon-picture />
|
|
|
|
- </el-icon>
|
|
|
|
- </template>
|
|
|
|
- </el-image>
|
|
|
|
- <div class="card-content">
|
|
|
|
- <div>
|
|
|
|
- <span style="color: #808d97; font-weight: 500">电脑编号: </span>
|
|
|
|
- <span style="font-weight: 500">{{ item.computerNumber }}</span>
|
|
|
|
- </div>
|
|
|
|
- <div>
|
|
|
|
- <span style="color: #808d97; font-weight: 500">所属店铺: </span>
|
|
|
|
- <span style="font-weight: 500">{{ item.shopName }}</span>
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
- <div class="card-footer">
|
|
|
|
- <el-button :icon="Search" bg circle text type="primary" @click="checkItem(item)" />
|
|
|
|
- <el-button :icon="EditPen" bg circle text type="warning" @click="editItem(item)" />
|
|
|
|
- </div>
|
|
|
|
- </el-card>
|
|
|
|
- </el-col>
|
|
|
|
- </el-row>
|
|
|
|
- </el-card>
|
|
|
|
- <div class="pagination-container" style="position: absolute; right: 40px; bottom: 50px">
|
|
|
|
- <el-pagination
|
|
|
|
- v-model:current-page="tableOptions.page"
|
|
|
|
- v-model:page-size="tableOptions.limit"
|
|
|
|
- :page-sizes="[6, 12, 24, 36, 48, 60]"
|
|
|
|
- :total="tableOptions.total"
|
|
|
|
- background
|
|
|
|
- layout="sizes, prev, pager, next, total"
|
|
|
|
- @change="handlePageChange"
|
|
|
|
- />
|
|
|
|
- </div>
|
|
|
|
- </el-card>
|
|
|
|
- <!-- 新增 Dialog -->
|
|
|
|
- <CreateComputer v-model="showDialog" :shopOptions :userOptions @refresh="fetchCardData"></CreateComputer>
|
|
|
|
- <!-- 编辑 Drawer -->
|
|
|
|
- <EditComputerInfo v-if="isDrawerVisible" @refresh="fetchCardData" v-model="isDrawerVisible" :shopOptions="shopOptions" :userOptions="userOptions" :computerInfo :computerNumber="computerInfo.computerNumber" />
|
|
|
|
|
|
+ <el-card class="flex-grow" style="border: none" :body-style="{ padding: '0px' }">
|
|
|
|
+ <el-card v-loading="loading" class="card-container" shadow="never" style="border: none">
|
|
|
|
+ <el-row :gutter="20">
|
|
|
|
+ <el-col v-for="(item, index) in tableOptions.data" :key="index" :lg="4" :md="6" :sm="8" :xl="4" :xs="12" class="my-2.5">
|
|
|
|
+ <el-card class="item-card" shadow="hover" :body-style="{ padding: '20px 20px 5px 20px' }">
|
|
|
|
+ <div class="image-wrapper">
|
|
|
|
+ <el-image :src="getImageUrl(item.images)" alt="电脑图片" class="card-image">
|
|
|
|
+ <template #error>
|
|
|
|
+ <el-icon class="card-image" style="font-size: 4rem">
|
|
|
|
+ <icon-picture />
|
|
|
|
+ </el-icon>
|
|
|
|
+ </template>
|
|
|
|
+ </el-image>
|
|
|
|
+ </div>
|
|
|
|
+ <hr style="box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2)" />
|
|
|
|
+ <div class="card-content">
|
|
|
|
+ <div class="text-wrapper">
|
|
|
|
+ <span style="color: #808d97; font-weight: 500">电脑编号: </span>
|
|
|
|
+ <span style="font-weight: 500">{{ item.computerNumber }}</span>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="text-wrapper">
|
|
|
|
+ <span style="color: #808d97; font-weight: 500">所属店铺: </span>
|
|
|
|
+ <span style="font-weight: 500">{{ item.shopName }}</span>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <template #footer>
|
|
|
|
+ <div style="text-align: center; padding: 0 10px">
|
|
|
|
+ <!--<el-button :icon="Search" bg circle text type="primary" @click="checkItem(item)" />-->
|
|
|
|
+ <!--<el-button :icon="EditPen" bg circle text type="warning" @click="editItem(item)" />-->
|
|
|
|
+ <el-button :icon="Search" plain round style="width: 100%" type="primary" @click="checkItem(item)"> 查看详情 </el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </el-card>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
|
|
+ </el-card>
|
|
|
|
+ <div class="pagination-container" style="position: absolute; right: 40px; bottom: 50px">
|
|
|
|
+ <el-pagination
|
|
|
|
+ v-model:current-page="tableOptions.page"
|
|
|
|
+ v-model:page-size="tableOptions.limit"
|
|
|
|
+ :page-sizes="[6, 12, 24, 36, 48, 60]"
|
|
|
|
+ :total="tableOptions.total"
|
|
|
|
+ background
|
|
|
|
+ layout="sizes, prev, pager, next, total"
|
|
|
|
+ @change="handlePageChange"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ </el-card>
|
|
|
|
+ <!-- 新增 Dialog -->
|
|
|
|
+ <CreateComputer v-model="showDialog" :shopOptions :userOptions @refresh="fetchCardData"></CreateComputer>
|
|
|
|
+ <!-- 编辑 Drawer -->
|
|
|
|
+ <!--<EditComputerInfo-->
|
|
|
|
+ <!-- v-if="isDrawerVisible"-->
|
|
|
|
+ <!-- v-model="isDrawerVisible"-->
|
|
|
|
+ <!-- :computerInfo-->
|
|
|
|
+ <!-- :computerNumber="computerInfo.computerNumber"-->
|
|
|
|
+ <!-- :shopOptions="shopOptions"-->
|
|
|
|
+ <!-- :userOptions="userOptions"-->
|
|
|
|
+ <!-- @refresh="fetchCardData"-->
|
|
|
|
+ <!--/>-->
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
.card-container {
|
|
.card-container {
|
|
margin-bottom: 30px;
|
|
margin-bottom: 30px;
|
|
|
|
+ padding: 0;
|
|
}
|
|
}
|
|
|
|
|
|
.item-card {
|
|
.item-card {
|
|
@@ -172,11 +187,31 @@ onMounted(() => {
|
|
width: 100%;
|
|
width: 100%;
|
|
height: 150px;
|
|
height: 150px;
|
|
object-fit: cover;
|
|
object-fit: cover;
|
|
|
|
+ padding-bottom: 10px;
|
|
}
|
|
}
|
|
|
|
|
|
.card-content {
|
|
.card-content {
|
|
- padding: 10px;
|
|
|
|
|
|
+ padding-top: 10px;
|
|
font-size: 14px;
|
|
font-size: 14px;
|
|
|
|
+ max-height: 60px; /* 根据需要设置最大高度 */
|
|
|
|
+ overflow: hidden; /* 隐藏超出部分 */
|
|
|
|
+ text-overflow: ellipsis; /* 省略号效果 */
|
|
|
|
+ display: -webkit-box; /* 适用于多行文本处理 */
|
|
|
|
+ -webkit-box-orient: vertical; /* 垂直排列 */
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.text-wrapper {
|
|
|
|
+ white-space: nowrap; /* 不换行 */
|
|
|
|
+ overflow: hidden; /* 隐藏超出部分 */
|
|
|
|
+ text-overflow: ellipsis; /* 省略号效果 */
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.image-wrapper {
|
|
|
|
+ width: 150px; /* 设置固定宽度 */
|
|
|
|
+ height: 150px; /* 设置固定高度 */
|
|
|
|
+ padding-bottom: 10px;
|
|
|
|
+ margin: 0 auto; /* 横向居中 */
|
|
|
|
+ overflow: hidden; /* 隐藏溢出部分 */
|
|
}
|
|
}
|
|
|
|
|
|
.card-footer {
|
|
.card-footer {
|
|
@@ -190,4 +225,10 @@ onMounted(() => {
|
|
justify-content: flex-end;
|
|
justify-content: flex-end;
|
|
// margin-bottom: 20px;
|
|
// margin-bottom: 20px;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+:deep(.el-card__footer) {
|
|
|
|
+ border-top: none;
|
|
|
|
+ padding: 0 0 10px 0;
|
|
|
|
+}
|
|
|
|
+
|
|
</style>
|
|
</style>
|