|
@@ -338,9 +338,9 @@ export default {
|
|
|
// 获取年份,获取季度、月度
|
|
|
const loading = this.$loading({
|
|
|
lock: true,
|
|
|
- text: 'Loading',
|
|
|
- spinner: 'el-icon-loading',
|
|
|
- background: 'rgba(0, 0, 0, 0.7)'
|
|
|
+ text: "Loading",
|
|
|
+ spinner: "el-icon-loading",
|
|
|
+ background: "rgba(0, 0, 0, 0.7)",
|
|
|
});
|
|
|
Promise.all([
|
|
|
this.getYearData(),
|
|
@@ -352,8 +352,8 @@ export default {
|
|
|
this.initChart();
|
|
|
})
|
|
|
.catch((error) => {
|
|
|
- loading.close()
|
|
|
- this.$message.error(error)
|
|
|
+ loading.close();
|
|
|
+ this.$message.error(error);
|
|
|
// console.error("Error fetching data:", error);
|
|
|
});
|
|
|
},
|
|
@@ -368,7 +368,8 @@ export default {
|
|
|
getAllIndustry() {
|
|
|
return listAllIndustry().then((response) => {
|
|
|
if (response?.rows) {
|
|
|
- this.industryData = response.rows.map((item) => ({
|
|
|
+ let arr = this.sortByCode(response.rows);
|
|
|
+ this.industryData = arr.map((item) => ({
|
|
|
key: item.code,
|
|
|
value: item.code + item.industryName,
|
|
|
}));
|
|
@@ -468,7 +469,6 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
updateChart(rawData) {
|
|
|
-
|
|
|
const that = this;
|
|
|
if (!this.chart) {
|
|
|
return;
|
|
@@ -496,15 +496,15 @@ export default {
|
|
|
} else if (this.sortActive === "desc") {
|
|
|
sortedData.sort((a, b) => {
|
|
|
if (a.rate === null && b.rate === null) return 0;
|
|
|
- if (a.rate === null) return 1; // 将null排在最后
|
|
|
- if (b.rate === null) return -1;
|
|
|
- if (a.rate === "Infinity" && b.rate === "Infinity") return 0;
|
|
|
- if (a.rate === "Infinity") return -1; // 将Infinity排在最前
|
|
|
- if (b.rate === "Infinity") return 1;
|
|
|
- // 转换为数字进行比较并进行降序排列
|
|
|
- return parseFloat(b.rate) - parseFloat(a.rate);
|
|
|
+ if (a.rate === null) return 1; // 将null排在最后
|
|
|
+ if (b.rate === null) return -1;
|
|
|
+ if (a.rate === "Infinity" && b.rate === "Infinity") return 0;
|
|
|
+ if (a.rate === "Infinity") return -1; // 将Infinity排在最前
|
|
|
+ if (b.rate === "Infinity") return 1;
|
|
|
+ // 转换为数字进行比较并进行降序排列
|
|
|
+ return parseFloat(b.rate) - parseFloat(a.rate);
|
|
|
});
|
|
|
- }else if(this.sortActive === "location") {
|
|
|
+ } else if (this.sortActive === "location") {
|
|
|
sortedData.sort((a, b) => a.location.localeCompare(b.location));
|
|
|
}
|
|
|
// 处理数据
|
|
@@ -671,6 +671,26 @@ export default {
|
|
|
this.sortActive = sortType;
|
|
|
this.updateChart(this.searchData);
|
|
|
},
|
|
|
+ sortByCode(arr) {
|
|
|
+ return arr.sort((a, b) => {
|
|
|
+ const numA = Number(a.code);
|
|
|
+ const numB = Number(b.code);
|
|
|
+
|
|
|
+ // 检查是否为有效数字
|
|
|
+ const isANum = !isNaN(numA);
|
|
|
+ const isBNum = !isNaN(numB);
|
|
|
+
|
|
|
+ if (isANum && isBNum) {
|
|
|
+ return numA - numB; // 都是数字,按数字升序排序
|
|
|
+ } else if (isANum) {
|
|
|
+ return -1; // a 是数字,放在前面
|
|
|
+ } else if (isBNum) {
|
|
|
+ return 1; // b 是数字,放在前面
|
|
|
+ } else {
|
|
|
+ return 0; // 都不是数字,保持原顺序
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
},
|
|
|
watch: {
|
|
|
// littlegreen - 关闭监测数值变化
|