2025-05-15 10:03:15 +08:00
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { onMounted, reactive, ref } from "vue";
|
|
|
|
|
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
|
|
|
|
import { getSmartCabinetList, type SmartCabinetDTO } from "@/api/cabinet/smart-cabinet";
|
|
|
|
|
import { type PaginationProps } from "@pureadmin/table";
|
|
|
|
|
import { CommonUtils } from "@/utils/common";
|
|
|
|
|
import { useRouter } from "vue-router";
|
|
|
|
|
import { CabinetImgMap } from "@/utils/cabinetImgMap";
|
|
|
|
|
|
|
|
|
|
import Search from "@iconify-icons/ep/search";
|
|
|
|
|
import Refresh from "@iconify-icons/ep/refresh";
|
|
|
|
|
import View from "@iconify-icons/ep/view";
|
|
|
|
|
import AddFill from "@iconify-icons/ri/add-circle-line";
|
|
|
|
|
import SmartCabinetCardFormModal from "./smart-cabinet-card-form-modal.vue";
|
2025-05-17 09:57:22 +08:00
|
|
|
|
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
2025-05-16 10:21:55 +08:00
|
|
|
|
const { VITE_PUBLIC_IMG_PATH: IMG_PATH } = import.meta.env;
|
2025-05-15 10:03:15 +08:00
|
|
|
|
|
|
|
|
|
defineOptions({
|
|
|
|
|
name: "SmartCabinetCard"
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
const formRef = ref();
|
|
|
|
|
const modalVisible = ref(false);
|
|
|
|
|
const searchFormParams = ref({
|
|
|
|
|
cabinetName: "",
|
|
|
|
|
cabinetType: null
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const pageLoading = ref(false);
|
|
|
|
|
const dataList = ref<SmartCabinetDTO[]>([]);
|
|
|
|
|
const pagination = ref<PaginationProps>({
|
|
|
|
|
total: 0,
|
2025-05-15 15:49:42 +08:00
|
|
|
|
pageSize: 12,
|
2025-05-15 10:03:15 +08:00
|
|
|
|
currentPage: 1,
|
|
|
|
|
background: true
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
async function onSearch() {
|
|
|
|
|
pagination.value.currentPage = 1;
|
|
|
|
|
getList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function getList() {
|
|
|
|
|
try {
|
|
|
|
|
pageLoading.value = true;
|
|
|
|
|
const { data } = await getSmartCabinetList({
|
|
|
|
|
...searchFormParams.value,
|
|
|
|
|
pageSize: pagination.value.pageSize,
|
|
|
|
|
pageNum: pagination.value.currentPage
|
|
|
|
|
});
|
|
|
|
|
dataList.value = data.rows;
|
|
|
|
|
pagination.value.total = data.total;
|
|
|
|
|
} finally {
|
|
|
|
|
pageLoading.value = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const resetForm = formEl => {
|
|
|
|
|
if (!formEl) return;
|
|
|
|
|
formEl.resetFields();
|
|
|
|
|
onSearch();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleViewDetail = (row: SmartCabinetDTO) => {
|
2025-05-17 09:57:22 +08:00
|
|
|
|
// 保存信息到标签页
|
|
|
|
|
useMultiTagsStoreHook().handleTags("push", {
|
|
|
|
|
path: `/cabinet/card/detail`,
|
|
|
|
|
name: "smartCabinetCardDetail",
|
|
|
|
|
query: { id: row.cabinetId },
|
|
|
|
|
meta: {
|
|
|
|
|
title: `${row.cabinetName}`,
|
|
|
|
|
dynamicLevel: 3
|
|
|
|
|
}
|
|
|
|
|
});
|
2025-05-15 10:03:15 +08:00
|
|
|
|
router.push({
|
|
|
|
|
path: '/cabinet/card/detail',
|
|
|
|
|
query: {
|
|
|
|
|
id: row.cabinetId
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
getList();
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<div class="main">
|
|
|
|
|
<div class="float-right w-full">
|
|
|
|
|
<el-form ref="formRef" :inline="true" :model="searchFormParams"
|
2025-05-15 16:59:28 +08:00
|
|
|
|
class="search-form bg-bg_color flex w-[99/100] pl-[22px] pt-[12px]">
|
|
|
|
|
<el-form-item label="" prop="cabinetName">
|
2025-05-15 10:03:15 +08:00
|
|
|
|
<el-input v-model="searchFormParams.cabinetName" placeholder="请输入柜体名称" clearable class="!w-[200px]" />
|
|
|
|
|
</el-form-item>
|
2025-05-15 16:59:28 +08:00
|
|
|
|
<el-form-item label="" prop="cabinetType">
|
|
|
|
|
<el-select v-model="searchFormParams.cabinetType" placeholder="请选择柜体类型" clearable class="!w-[180px]">
|
2025-05-15 10:03:15 +08:00
|
|
|
|
<el-option label="主柜" :value="0" />
|
|
|
|
|
<el-option label="副柜" :value="1" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button type="primary" :icon="useRenderIcon(Search)" :loading="pageLoading" @click="onSearch">
|
|
|
|
|
搜索
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button :icon="useRenderIcon(Refresh)" @click="resetForm(formRef)">
|
|
|
|
|
重置
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-form-item>
|
2025-05-15 16:59:28 +08:00
|
|
|
|
<el-form-item class="space-item">
|
|
|
|
|
</el-form-item>
|
2025-05-15 10:03:15 +08:00
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button type="primary" :icon="useRenderIcon(AddFill)" @click="modalVisible = true"
|
|
|
|
|
style="margin-right: 10px;">
|
|
|
|
|
新增设备
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
|
|
<div class="grid-container">
|
2025-05-15 16:59:28 +08:00
|
|
|
|
<el-row :gutter="12">
|
2025-05-15 10:03:15 +08:00
|
|
|
|
<el-col v-for="(item, index) in dataList" :key="item.cabinetId" :xs="24" :sm="12" :md="8" :lg="4" :xl="4">
|
|
|
|
|
<el-card class="cabinet-card" :body-style="{ padding: '8px 20px' }">
|
|
|
|
|
<div class="card-content">
|
2025-05-21 15:05:15 +08:00
|
|
|
|
<img :src="`${IMG_PATH}img/cabinet/${CabinetImgMap[item.templateNo]?.img || 'default.jpg'}`"
|
2025-05-15 10:03:15 +08:00
|
|
|
|
class="cabinet-image" />
|
2025-05-15 15:49:42 +08:00
|
|
|
|
<el-descriptions class="cabinet-info" :column="2">
|
|
|
|
|
<el-descriptions-item class="name" :span="2">柜体名称:{{ item.cabinetName }}
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
<!-- <div class="type">柜体类型:{{ item.cabinetType === 0 ? '主柜' : '副柜' }}</div> -->
|
|
|
|
|
<el-descriptions-item class="template">模板:{{ CabinetImgMap[item.templateNo]?.name || '-' }}
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item class="shop">商店:{{ item.shopName || '-' }}
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
</el-descriptions>
|
2025-05-15 10:03:15 +08:00
|
|
|
|
</div>
|
|
|
|
|
<el-divider class="divider" />
|
|
|
|
|
<el-button class="detail-btn" :icon="useRenderIcon(View)" @click="handleViewDetail(item)" />
|
|
|
|
|
</el-card>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<div class="pagination-wrapper">
|
|
|
|
|
<el-pagination background layout="prev, pager, next" :page-size="pagination.pageSize"
|
|
|
|
|
:total="pagination.total" v-model:current-page="pagination.currentPage" @current-change="getList"
|
|
|
|
|
@size-change="getList" />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-05-21 15:05:15 +08:00
|
|
|
|
<el-drawer v-model="modalVisible" title="新增智能柜" size="30%" direction="rtl">
|
|
|
|
|
<smart-cabinet-card-form-modal v-model="modalVisible" @refresh="getList" />
|
|
|
|
|
</el-drawer>
|
2025-05-15 10:03:15 +08:00
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
.search-form {
|
|
|
|
|
:deep(.el-form-item) {
|
|
|
|
|
margin-bottom: 12px;
|
2025-05-15 16:59:28 +08:00
|
|
|
|
margin-right: 12px;
|
2025-05-15 10:03:15 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2025-05-16 10:21:55 +08:00
|
|
|
|
|
2025-05-15 15:49:42 +08:00
|
|
|
|
:deep(.el-descriptions__cell) {
|
2025-05-16 10:21:55 +08:00
|
|
|
|
padding-bottom: 1px !important;
|
2025-05-15 15:49:42 +08:00
|
|
|
|
}
|
2025-05-16 10:21:55 +08:00
|
|
|
|
|
2025-05-15 10:03:15 +08:00
|
|
|
|
.cabinet-card {
|
2025-05-15 16:59:28 +08:00
|
|
|
|
margin-bottom: 12px;
|
2025-05-15 10:03:15 +08:00
|
|
|
|
min-height: 210px;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
|
|
|
|
.cabinet-image {
|
|
|
|
|
width: 100%;
|
2025-05-15 15:49:42 +08:00
|
|
|
|
height: 200px;
|
|
|
|
|
object-fit: contain;
|
2025-05-15 10:03:15 +08:00
|
|
|
|
border-radius: 4px;
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.card-content {
|
|
|
|
|
flex: 1;
|
|
|
|
|
margin: 15px 0px;
|
|
|
|
|
|
|
|
|
|
.cabinet-info {
|
|
|
|
|
text-align: left;
|
|
|
|
|
|
|
|
|
|
.name,
|
|
|
|
|
.type,
|
|
|
|
|
.shop,
|
|
|
|
|
.location,
|
|
|
|
|
.template {
|
2025-05-15 15:49:42 +08:00
|
|
|
|
width: 100%;
|
2025-05-15 10:03:15 +08:00
|
|
|
|
font-size: 14px;
|
|
|
|
|
color: #606266;
|
|
|
|
|
margin-bottom: 6px;
|
2025-05-15 15:49:42 +08:00
|
|
|
|
line-height: 1;
|
|
|
|
|
text-align: left;
|
2025-05-15 10:03:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.name {
|
2025-05-15 15:49:42 +08:00
|
|
|
|
width: 100%;
|
2025-05-15 10:03:15 +08:00
|
|
|
|
font-weight: 500;
|
|
|
|
|
color: #303133;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.divider {
|
2025-05-15 16:59:28 +08:00
|
|
|
|
margin: 5px 0px;
|
2025-05-15 10:03:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.detail-btn {
|
|
|
|
|
width: 100%;
|
|
|
|
|
border: 0;
|
|
|
|
|
margin-top: auto;
|
2025-05-15 16:59:28 +08:00
|
|
|
|
padding: 8px 0;
|
2025-05-15 10:03:15 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.grid-container {
|
2025-05-15 16:59:28 +08:00
|
|
|
|
margin: 12px 0;
|
2025-05-15 10:03:15 +08:00
|
|
|
|
position: relative;
|
|
|
|
|
|
|
|
|
|
.el-row {
|
|
|
|
|
margin-bottom: -20px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.pagination-wrapper {
|
|
|
|
|
position: relative;
|
|
|
|
|
background: var(--el-bg-color);
|
2025-05-15 16:59:28 +08:00
|
|
|
|
padding: 8px 12px;
|
2025-05-15 10:03:15 +08:00
|
|
|
|
margin-top: 20px;
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
|
|
|
|
:deep(.el-pagination) {
|
|
|
|
|
margin: 0;
|
2025-05-15 16:59:28 +08:00
|
|
|
|
padding: 4px 0;
|
2025-05-15 10:03:15 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2025-05-15 16:59:28 +08:00
|
|
|
|
|
|
|
|
|
.space-item {
|
|
|
|
|
flex: 1;
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
2025-05-15 10:03:15 +08:00
|
|
|
|
</style>
|