From a009c0021cd72a2c7379b7b04eacd694e0cb98f2 Mon Sep 17 00:00:00 2001 From: tanghaolin <1723298894@qq.com> Date: 星期四, 13 二月 2025 21:32:27 +0800 Subject: [PATCH] 修改能效标识查询页面 --- src/views/IndustrialSoftware.vue | 78 ++++++++++++++++++++------------------ 1 files changed, 41 insertions(+), 37 deletions(-) diff --git a/src/views/IndustrialSoftware.vue b/src/views/IndustrialSoftware.vue index ef2c5cc..2c8ce45 100644 --- a/src/views/IndustrialSoftware.vue +++ b/src/views/IndustrialSoftware.vue @@ -9,15 +9,10 @@ <div class="flex items-center"> <span class="text-gray-500">绫诲瀷锛�</span> <div class="flex flex-1"> - <span - v-for="item in type" - class="ant-tag !px-4" - :class="typeSelect === item.tag ? 'ant-tag-checked' : ''" - :key="item.tag" + <span v-for="item in type" class="ant-tag !px-4" + :class="typeSelect === item.tag ? 'ant-tag-checked' : ''" :key="item.tag" @click="changeSelectType(item.tag)" - :type="typeSelect === item.tag ? 'primary' : 'default'" - size="small" - > + :type="typeSelect === item.tag ? 'primary' : 'default'" size="small"> {{ item.name }} </span> </div> @@ -29,16 +24,10 @@ <div class="flex items-center"> <span class="text-gray-500">鍘傚晢锛�</span> <div class="flex flex-1"> - <span - v-for="item in factory" - :key="item.tag" - class="ant-tag !px-4" - :class="factorySelect === item.tag ? 'ant-tag-checked' : ''" - :type="factorySelect === item.tag ? 'primary' : 'default'" - @click="factorySelect = item.tag" - size="small" - > - {{ item.name }} + <span v-for="item in factory" :key="item.CompanyId" class="ant-tag !px-4" + :class="factorySelect === item.CompanyId ? 'ant-tag-checked' : ''" + @click="factorySelect = item.CompanyId" size="small"> + {{ item.CompanyAbbName }} </span> </div> </div> @@ -49,9 +38,7 @@ <ul> <li v-for="sort in EecClass" :key="sort.tag" size="small" @click="handleEecLevel(sort.tag)" :type="EecSelect === sort.tag ? 'primary' : 'default'" - :class="EecSelect == sort.tag ? 'eec-filter-currentOrder' : ''" - class="!px-6" - > + :class="EecSelect == sort.tag ? 'eec-filter-currentOrder' : ''" class="!px-6"> {{ sort.name }} </li> </ul> @@ -70,8 +57,9 @@ <div class="goods-name" :title="app.Model">{{ app.ModelType }}</div> <div class="metertitle mb-2"><span>鍨嬪彿锛歿{ app.Model }}</span></div> <!-- <p class="text-gray-500 text-sm mb-4 flex-1">{{ app.description }}</p> --> - <div class="flex flex-wrap gap-2" style=""> + <div class="flex gap-2" style="justify-content: space-between;align-items: center;"> <!-- <el-tag size="small" type="success">{{ app.CompanyName }}</el-tag> --> + <div class="goods-price"><span class="goods-price-selling"> 楼{{ app.Price }}</span> </div> <div class="flex items-center eec-level-div"> <img :src="EecLevelEnum[app.EnergyEfficiencyClass].icon"> <span class="eec-numb">{{ app.EnergyEfficiencyClass }}</span> @@ -79,7 +67,7 @@ }}</span> </div> </div> - <div class="goods-price"><span class="goods-price-selling">{{ app.price }}</span> </div> + <!-- <div class="flex justify-between items-center"> <el-rate v-model="app.rating" disabled /> <span class="text-gray-400 text-sm">{{ app.date }}</span> @@ -110,7 +98,7 @@ import EecLevel2 from '@/assets/icons/energy_level_2.svg'; import { onMounted, ref } from 'vue'; import { useRouter } from 'vue-router'; - +import axios from 'axios'; const router = useRouter(); // 鍒嗙被閫夐」 @@ -123,10 +111,7 @@ { name: "宸ヤ笟閿呯倝", tag: 6 }, { name: "鐢垫満", tag: 7 }, ]; -const factory = [ - { name: '鍏ㄩ儴', tag: '鍏ㄩ儴' }, - { name: '鍑硥', tag: '鍑硥' }, -]; +const factory = ref([]); const EecClass = [ { name: "鍏ㄩ儴", tag: 0 }, { name: "涓�绾ц兘鏁�", tag: 1 }, @@ -137,7 +122,7 @@ // 閫変腑鐘舵�� const typeSelect = ref(1); -const factorySelect = ref('鍏ㄩ儴'); +const factorySelect = ref('-99'); const EecSelect = ref(0); const EecLevelEnum = { @@ -169,10 +154,27 @@ }) onMounted(() => { + initComanyData(); initData(); // filterProduct(); }) - +const initComanyData = () => { + axios({ + method: 'get', + url: 'static/EecProductData/CompanyData.json', + }).then((res) => { + let result = res.data; + factory.value = result.map((item: any) => { + return { + CompanyId: item.CompanyId, + CompanyAllName: item.CompanyAllName, + CompanyAbbName: item.CompanyAbbName, + Type: item.Type, + } + }) + factory.value.unshift({ CompanyId: "-99", CompanyAllName: '鍏ㄩ儴', CompanyAbbName: '鍏ㄩ儴', Type: null }) + }).catch((err) => { }) +} const initData = () => { m_PageLoading.value = true; axios({ @@ -184,7 +186,7 @@ let arr = []; result.forEach((item: any) => { let node = { - Id: item.ID, + Id: item.Id, Type: item.Type, ModelType: item.ModelType, Model: item.Model, @@ -192,6 +194,7 @@ RecordNumber: item.RecordNumber, EnergyEfficiencyClass: item.EnergyEfficiencyClass, RecordTime: item.RecordTime, + Price: item.Price, PhysicalPicturePath: "/static/EecProductData/" + item.PhysicalPicturePath, CertificatePath: `/static/EecProductData/${item.CertificatePath}`, Tip: `澶囨鏃堕棿锛�${item.RecordTime} \n 澶囨鍙凤細${item.RecordNumber}`, @@ -208,12 +211,13 @@ filterProductData.value = allEecProduct.value.filter((item) => { return item.Type === typeSelect.value }) + if (EecSelect.value !== 0) { filterProductData.value = filterProductData.value.filter((item) => { return item.EnergyEfficiencyClass === EecSelect.value }) } - if (factorySelect.value !== '鍏ㄩ儴') { + if (factorySelect.value !== '-99') { filterProductData.value = filterProductData.value.filter((item) => { return item.CompanyName === factorySelect.value }) @@ -223,13 +227,13 @@ } const handleCurrentChange = (val: number) => { m_paginationConfig.value.currentPage = val; - let allTableData = allEecProduct.value; + let allTableData = filterProductData.value; let pagingData = getSelectPageData(allTableData); dispEecProduct.value = pagingData; } const handleSizeChange = (val: number) => { m_paginationConfig.value.currentPage = val; - let allTableData = allEecProduct.value; + let allTableData = filterProductData.value; let pagingData = getSelectPageData(allTableData); dispEecProduct.value = pagingData; } @@ -247,13 +251,13 @@ const changeSelectType = (tag: number) => { typeSelect.value = tag; initData(); - }; const handleBuyClick = (productId: string) => { // 鎵惧埌褰撳墠鐐瑰嚮鐨勪骇鍝� const currentProduct = dispEecProduct.value.find((item) => item.id === productId); if (currentProduct) { + console.log("馃殌 ~ currentProduct:", currentProduct) // 淇濆瓨浜у搧淇℃伅鍒發ocalStorage localStorage.setItem('currentProduct', JSON.stringify(currentProduct)); } @@ -383,7 +387,7 @@ } .goods-price { - width: 100%; + /* width: 100%; */ padding: 0 3px; text-align: left; box-sizing: border-box; @@ -400,7 +404,7 @@ } .goods-price .goods-price-selling { - font-size: 14px; + font-size: 16px; font-weight: 700; color: #f74747; } -- Gitblit v1.9.3