From 060c875b23539dc338e780ddfc187394a40743a9 Mon Sep 17 00:00:00 2001 From: 杨磊 <505174330@qq.com> Date: 星期一, 28 四月 2025 21:06:46 +0800 Subject: [PATCH] bug修改 --- src/views/directory/index.vue | 211 ++++++++++++++++++++++++++++++++++------------------ 1 files changed, 138 insertions(+), 73 deletions(-) diff --git a/src/views/directory/index.vue b/src/views/directory/index.vue index 9a1ea8c..7af5d22 100644 --- a/src/views/directory/index.vue +++ b/src/views/directory/index.vue @@ -7,18 +7,33 @@ </div> <div class="page-main-father"> <div class="page-main-title"> - <p @click="changeTab('chart')" :class="[activeTabs == 'chart' ? 'active-tab' : '']"> - <img :src="[activeTabs == 'chart' ? chartIcon : noChartIcon]" alt="" /> + <p + @click="changeTab('chart')" + :class="[activeTabs == 'chart' ? 'active-tab' : '']" + > + <img + :src="[activeTabs == 'chart' ? chartIcon : noChartIcon]" + alt="" + /> <span>鍥捐〃鏄剧ず</span> </p> - <p @click="changeTab('list')" :class="[activeTabs == 'list' ? 'active-tab' : '']"> + <p + @click="changeTab('list')" + :class="[activeTabs == 'list' ? 'active-tab' : '']" + > <img :src="[activeTabs == 'list' ? listIcon : noListIcon]" alt="" /> <span>鍒楄〃鏄剧ず</span> </p> </div> <!-- 鍥捐〃鏄剧ず --> - <div class="charts-main" v-show="activeTabs == 'chart'" v-loading="loading" element-loading-text="鍥捐〃鍔犺浇涓�" - element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0)"> + <div + class="charts-main" + v-show="activeTabs == 'chart'" + v-loading="loading" + element-loading-text="鍥捐〃鍔犺浇涓�" + element-loading-spinner="el-icon-loading" + element-loading-background="rgba(0, 0, 0, 0)" + > <div class="radial-tree-container" v-show="!loading"> <div ref="chart" style="width: 100%; height: 70vh"></div> </div> @@ -33,36 +48,49 @@ </div> <transition name="el-fade-in-linear"> <div class="tooltipBox" v-show="tooltipShow"> - <div style=" + <div + style=" padding: 10px; background: #fdf8f0; border-radius: 5px; width: 100%; max-height: 500px; text-align: center; - "> + " + > <div class="closeBtn" @click="tooltipShow = false"> <i class="el-icon-close"></i> </div> <div style="display: flex"> - <div style=" + <div + style=" width: 80px; height: 80px; position: relative; margin-bottom: 10px; background: #d8d8d8; - "> - <img class="autoImg" :src="currentNodeInfo.icon - ? currentNodeInfo.icon - : '@/assets/images/directory/touxiang.png' - " alt="" /> + " + > + <img + class="autoImg" + :src=" + currentNodeInfo.icon + ? currentNodeInfo.icon + : '@/assets/images/directory/touxiang.png' + " + alt="" + /> </div> - <div style="padding-top: 20px; text-align: left; margin-left: 20px"> - <div style=" + <div + style="padding-top: 20px; text-align: left; margin-left: 20px" + > + <div + style=" font-size: 16px; font-weight: bold; margin-bottom: 5px; - "> + " + > {{ currentNodeInfo.name }} </div> <div style="margin-top: 20px"> @@ -83,13 +111,15 @@ </div> </div> - <div style=" + <div + style=" font-size: 16px; font-weight: bold; margin-bottom: 5px; text-align: left; margin-top: 10px; - "> + " + > <p style="margin-bottom: 15px"> 瀛︿範鏃堕棿锛歿{ currentNodeInfo.studyTime || "-" }} </p> @@ -104,13 +134,15 @@ 鑱岀О锛歿{ currentNodeInfo.professionalTitle || "-" }} </p> </div> - <div style=" + <div + style=" text-align: left; line-height: 22px; max-height: 200px; overflow-y: auto; padding: 10px; - "> + " + > <div v-html="currentNodeInfo.studentProfile"></div> </div> <!-- <div @@ -135,21 +167,36 @@ </div> <!-- 鍒楄〃鏄剧ず --> <div class="page-main" v-show="activeTabs == 'list'"> - <div v-loading="loading" style="min-height: 550px" element-loading-background="rgba(0, 0, 0, 0)" - element-loading-text="瀛︾敓鍒楄〃鍔犺浇涓�" element-loading-spinner="el-icon-loading"> + <div + v-loading="loading" + style="min-height: 550px" + element-loading-background="rgba(0, 0, 0, 0)" + element-loading-text="瀛︾敓鍒楄〃鍔犺浇涓�" + element-loading-spinner="el-icon-loading" + > <div v-for="(item, index) in universityList" :key="index"> - <div class="table-title" v-if="item.agreelist && item.agreelist.length > 0"> + <div + class="table-title" + v-if="item.agreelist && item.agreelist.length > 0" + > <div class="table-title-left"> <p class="table-title-name">{{ item.unitName }}</p> </div> - <div class="table-title-right" @click="item.isShow = !item.isShow"> + <div + class="table-title-right" + @click="item.isShow = !item.isShow" + > <img :src="[item.isShow ? topIcon : bottomIcon]" alt="" /> </div> </div> - <div v-if="item.agreelist && item.agreelist.length > 0 && item.isShow"> + <div + v-if="item.agreelist && item.agreelist.length > 0 && item.isShow" + > <div v-for="(citem, cindex) in item.agreelist" :key="cindex"> <div class="agree-title"> - <p class="table-title-degree">{{ citem.academicDegreeName }}</p> + <p class="table-title-degree"> + {{ citem.academicDegreeName }} + </p> <p class="table-title-number"> {{ citem.studentList.length }}浜� </p> @@ -163,7 +210,10 @@ <th>鑱屽姟</th> <th>鑱岀О</th> </tr> - <tr v-for="(ditem, dindex) in citem.studentList" :key="dindex"> + <tr + v-for="(ditem, dindex) in citem.studentList" + :key="dindex" + > <td> {{ ditem.name }} </td> @@ -182,7 +232,7 @@ <td> {{ ditem.professionalTitle === undefined || - ditem.professionalTitle === "" + ditem.professionalTitle === "" ? "-" : ditem.professionalTitle }} @@ -286,7 +336,7 @@ backgroundColor: "#FDF8F0", formatter: (params) => { const data = params.data; - this.currentNodeInfo = data; + // this.currentNodeInfo = data; // console.log(data, "data"); if (data.cmsItemType == "student") { return ` @@ -299,50 +349,59 @@ text-align: center; "> <div style="width: 80px;height: 80px;position: relative; margin: 0 auto; margin-bottom: 10px;background: #D8D8D8;"> - <img class="autoImg" src="${data.icon - ? data.icon - : require("@/assets/images/directory/touxiang.png") - }" alt=""> + <img class="autoImg" src="${ + data.icon + ? data.icon + : require("@/assets/images/directory/touxiang.png") + }" alt=""> </div> - <div style="font-size: 16px; font-weight: bold; margin-bottom: 5px;">${data.name || "-" + <div style="font-size: 16px; font-weight: bold; margin-bottom: 5px;">${ + data.name || "-" }</div> - <div> <span> ${data.gender == "male" ? "鐢�" : "濂�" || "-" - } </span> <span> ${data.academicName || "-"} </span> <span> ${this.legendList.find((item) => item.value == data.unit)?.name || + <div> <span> ${ + data.gender == "male" ? "鐢�" : "濂�" || "-" + } </span> <span> ${data.academicName || "-"} </span> <span> ${ + this.legendList.find((item) => item.value == data.unit)?.name || "-" - } </span></div> + } </span></div> <div style="font-size: 16px; font-weight: bold; margin-bottom: 5px;text-align: left;margin-top: 10px;overflow: hidden;"> - <p style="margin-bottom: 5px;">瀛︿範鏃堕棿锛�${data.studyTime || "-" - }</p> - <p style="margin-bottom: 5px; white-space: pre-wrap" >鐜板伐浣滃崟浣嶏細${data.currentEmployer_secondary || "-" - }</p> - <p style="margin-bottom: 5px;">鑱屽姟锛�${data.jobTitle || "-" - }</p> - <p style="margin-bottom: 5px;">鑱岀О锛�${data.professionalTitle || "-" - }</p> + <p style="margin-bottom: 5px;">瀛︿範鏃堕棿锛�${ + data.studyTime || "-" + }</p> + <p style="margin-bottom: 5px; white-space: pre-wrap" >鐜板伐浣滃崟浣嶏細${ + data.currentEmployer_secondary || "-" + }</p> + <p style="margin-bottom: 5px;">鑱屽姟锛�${ + data.jobTitle || "-" + }</p> + <p style="margin-bottom: 5px;">鑱岀О锛�${ + data.professionalTitle || "-" + }</p> </div> </div> `; - } else { - return ` - <div style=" - padding: 10px; - background: #FDF8F0; - border-radius: 5px; - max-width: 300px; - width: 360px; - text-align: center; - "> - <div style="width: 80px;height: 80px;position: relative; margin: 0 auto; margin-bottom: 10px;background: #D8D8D8;"> - <img class="autoImg" src="${require("@/assets/images/directory/touxiang.png")}" alt=""> - </div> - <div style="font-size: 16px; font-weight: bold; margin-bottom: 5px;">${data.name - }</div> - <div> <span> ${data.academicDegreeName || "-"} </span></div> - - </div> - `; } + // } else { + // return ` + // <div style=" + // padding: 10px; + // background: #FDF8F0; + // border-radius: 5px; + // max-width: 300px; + // width: 360px; + // text-align: center; + // "> + // <div style="width: 80px;height: 80px;position: relative; margin: 0 auto; margin-bottom: 10px;background: #D8D8D8;"> + // <img class="autoImg" src="${require("@/assets/images/directory/touxiang.png")}" alt=""> + // </div> + // <div style="font-size: 16px; font-weight: bold; margin-bottom: 5px;">${data.name + // }</div> + // <div> <span> ${data.academicDegreeName || "-"} </span></div> + + // </div> + // `; + // } }, }, textStyle: { @@ -369,7 +428,7 @@ }, label: { - position: "top", //鏍囩鐨勪綅缃�� + // position: "left", //鏍囩鐨勪綅缃�� verticalAlign: "middle", //鏂囧瓧鍨傜洿瀵归綈鏂瑰紡锛岄粯璁よ嚜鍔ㄣ�� fontSize: 12, //鏂囧瓧鐨勫瓧浣撳ぇ灏� // color: "#bc1c00", @@ -382,7 +441,6 @@ // }, expandAndCollapse: false, lineStyle: { - // color: "#bc1c00", width: 1, }, itemStyle: { @@ -401,7 +459,11 @@ this.chart.setOption(option); this.chart.on("click", (params) => { // console.log("鐐瑰嚮鏃剁殑鍥炶皟", params); + console.log(params, "params"); + if (params.data?.cmsItemType && params.data?.cmsItemType == "student") { this.tooltipShow = true; + this.currentNodeInfo = params.data; + } }); }, handleResize() { @@ -492,7 +554,7 @@ studentList: [], }); }); - }) + }); console.log(schoolList, "schoolList"); this.unitList.forEach((item) => { this.academicDegreeList.forEach((citem) => { @@ -509,7 +571,7 @@ this.legendList.find( (legendItem) => legendItem.value === item.value )?.color || "#000000", - }, + }, children: [], }); }); @@ -525,6 +587,7 @@ (f) => f.value == item.academicDegree )?.name; citem.studentList.push(item); + item['itemStyle'] = citem.itemStyle; citem.children.push(item); } }); @@ -533,7 +596,10 @@ res.datas.forEach((item) => { schoolList.forEach((citem) => { citem.agreelist.forEach((ditem) => { - if (item.unit == citem.unitValue && item.academicDegree == ditem.academicDegreeValue) { + if ( + item.unit == citem.unitValue && + item.academicDegree == ditem.academicDegreeValue + ) { ditem.studentList.push(item); } }); @@ -544,7 +610,9 @@ // 浣跨敤filter鏂规硶杩囨护schoolList锛屽垹闄greelist闀垮害涓�0鐨刬tem schoolList = schoolList.filter((item) => { // 鍏堣繃婊ゆ帀閭d簺studentList闀垮害涓�0鐨刢item - item.agreelist = item.agreelist.filter((citem) => citem.studentList.length > 0); + item.agreelist = item.agreelist.filter( + (citem) => citem.studentList.length > 0 + ); // 鐒跺悗妫�鏌ヨ繃婊ゅ悗鐨刟greelist闀垮害鏄惁澶т簬0 return item.agreelist.length > 0; }); @@ -672,7 +740,6 @@ line-height: 20px; } - th { font-family: Source Han Serif CN; font-size: 14px; @@ -720,7 +787,6 @@ margin-top: 2px; line-height: 35px; - .table-title-left { display: flex; align-items: center; @@ -746,7 +812,6 @@ height: auto; } } - .agree-title { display: flex; -- Gitblit v1.9.1