From 57ca86ab00caa6487358aa38cf4bc40939e06503 Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期二, 03 九月 2024 19:42:56 +0800 Subject: [PATCH] 数据中心样式优化 --- src/views/system/check/result/index.vue | 62 ++++++++++++++++++------------ 1 files changed, 37 insertions(+), 25 deletions(-) diff --git a/src/views/system/check/result/index.vue b/src/views/system/check/result/index.vue index 7825ca2..e261e84 100644 --- a/src/views/system/check/result/index.vue +++ b/src/views/system/check/result/index.vue @@ -4,8 +4,8 @@ <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect" style="margin-bottom: 10px"> <el-menu-item index="0">鐪佸巺鏈堝害</el-menu-item> - <el-menu-item index="1">甯傚眬鏈堝害</el-menu-item> <el-menu-item index="2">鐪佸巺瀛e害</el-menu-item> + <el-menu-item index="1">甯傚眬鏈堝害</el-menu-item> <el-menu-item index="3">甯傚眬瀛e害</el-menu-item> </el-menu> </div> @@ -35,7 +35,7 @@ <div class="score-item"> <div style="font-size: 15px; margin-bottom: 15px">{{ formatCreateDate(city[0]) }}</div> </div> - <div v-for="(score, scoreIndex) in city" :key="scoreIndex"> + <div v-for="(score, scoreIndex) in filterRepeat(city)" :key="scoreIndex"> <div class="score-item"> <div v-if="score.examineCategory == 2">杞﹁締锛�</div> <div v-else-if="score.examineCategory == 3">浜鸿劯锛�</div> @@ -78,12 +78,6 @@ activeIndex: '0', date: '', company: '', - dataList: { - name: ['瀵岄『鍘�', '鑽e幙', '楂樻柊鍖�', '鑷祦浜曞尯', '璐′簳鍖�', '澶у畨鍖�', '娌挎哗鍖�'], - data1: [95, 96, 97, 95, 94.5, 93.6, 94.5], - data2: [93.7, 93.5, 94.3, 96.5, 95.3, 94.2, 93.3], - data3: [98.3, 94.3, 93.3, 95.5, 96.8, 96.1, 95.8], - }, // 鏌ヨ鍙傛暟 queryParams: { examineTag: null, @@ -92,13 +86,13 @@ } }, created() { + }, + mounted() { this.queryParams.examineTag = this.activeIndex this.getList(); this.areaSelect(); - }, - mounted() { chart = echarts.init(this.$refs.barChart); - this.initEchart(); + this.setChartOption(this.checkScoreList); }, methods: { jumpDetail(index) { @@ -204,7 +198,7 @@ }, yAxis: { - min: 60 + min: 0 }, series: [ { @@ -238,17 +232,22 @@ } chart.setOption(option, true); }, - filterData(data, tag) { - if (!data) return; - if(!Array.isArray(data)) return; + filterData(mapData, tag) { + if (!mapData) return; + if(!Array.isArray(mapData)) return; const tempArray = []; - data.forEach((item) => { + mapData.forEach((item) => { if(item.data.length) { + let flag = false; item.data.forEach((examine) => { if(examine.examineCategory === tag) { + flag = true tempArray.push(examine.score); } }) + if(!flag){ + tempArray.push(0); + } } }) return tempArray; @@ -269,14 +268,27 @@ return city.some(score => score.publish === 'UNPUBLISHED'); }, formatCreateDate(item) { - let date = new Date(item.startDate); - let year = date.getFullYear(); - let startMonth = date.getMonth() + 1; - date = new Date(item.endDate); - let endMonth = date.getMonth() + 1; - let str = `${year}骞�${startMonth}鏈坄; - if (startMonth !== endMonth) str += `-${endMonth}鏈坄; - return str; + const date = new Date(item.createTime); + const year = date.getFullYear(); + const month = date.getMonth() + 1; // getMonth() 杩斿洖鐨勬湀浠芥槸浠� 0 寮�濮嬬殑锛屾墍浠ヨ鍔� 1 + const day = date.getDate(); + + // 浣跨敤 padStart 鏂规硶纭繚鏈堜唤鍜屾棩鏈熷缁堟槸涓や綅鏁� + const formattedMonth = month.toString().padStart(2, '0'); + const formattedDay = day.toString().padStart(2, '0'); + + return `${year}骞�${formattedMonth}鏈�${formattedDay}鍙穈; + }, + filterRepeat(city) { + let list = []; + let examineCategorys = []; + city.forEach(item => { + if (examineCategorys.indexOf(item.examineCategory) === -1) { + examineCategorys.push(item.examineCategory); + list.push(item); + } + }); + return list; }, /** 瀵艰埅鍒囨崲 */ handleSelect(key) { @@ -301,8 +313,8 @@ listScore(this.queryParams).then(response => { this.checkScoreList = response.data; console.log(this.checkScoreList); - this.loading = false; this.setChartOption(this.checkScoreList); + this.loading = false; }); }, publish(city) { -- Gitblit v1.8.0