2.6 盈利能力模块表格完善
This commit is contained in:
@@ -96,21 +96,16 @@ const _sfc_main = {
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 筛选后的股票列表
|
||||
// 筛选后的股票列表:按板块codes匹配 + 连板排序/筛选
|
||||
filteredStocks() {
|
||||
var _a;
|
||||
if (!this.allStocks.length)
|
||||
if (!((_a = this.originData) == null ? void 0 : _a.stocks) || !this.bkList.length)
|
||||
return [];
|
||||
let stocks = [...this.allStocks];
|
||||
if (this.activeIndex >= 0 && this.bkList.length) {
|
||||
const currentSector = (_a = this.bkList[this.activeIndex]) == null ? void 0 : _a.title;
|
||||
if (currentSector) {
|
||||
stocks = stocks.filter((stock) => {
|
||||
const sectorMatch = stock.core_sectors.some((s) => s.includes(currentSector)) || (Array.isArray(stock.sector_category) ? stock.sector_category.includes(currentSector) : stock.sector_category === currentSector);
|
||||
return sectorMatch;
|
||||
});
|
||||
}
|
||||
}
|
||||
const currentBk = this.bkList[this.activeIndex];
|
||||
if (!(currentBk == null ? void 0 : currentBk.codes) || currentBk.codes.length === 0)
|
||||
return [];
|
||||
const targetCodes = new Set(currentBk.codes);
|
||||
let stocks = this.originData.stocks.filter((stock) => targetCodes.has(stock.scode));
|
||||
switch (this.filterIndex) {
|
||||
case 0:
|
||||
stocks.sort((a, b) => {
|
||||
@@ -134,7 +129,7 @@ const _sfc_main = {
|
||||
onLoad(e) {
|
||||
this.activeIndex = e.index;
|
||||
this.selectedFullDate = e.data;
|
||||
common_vendor.index.__f__("log", "at pagesStock/stockCenterDetails/bkydmx.vue:237", "selectedFullDate", this.selectedFullDate);
|
||||
common_vendor.index.__f__("log", "at pagesStock/stockCenterDetails/bkydmx.vue:229", "selectedFullDate", this.selectedFullDate);
|
||||
this.contentTop = this.navH + 20 / 750 * common_vendor.inject("windowWidth");
|
||||
this.fetchData();
|
||||
},
|
||||
@@ -230,7 +225,6 @@ const _sfc_main = {
|
||||
setStockRoles() {
|
||||
if (!this.originData || !this.originData.stocks || !this.bkList.length)
|
||||
return;
|
||||
common_vendor.index.__f__("log", "at pagesStock/stockCenterDetails/bkydmx.vue:357", "setStockRoles", JSON.stringify(this.originData.stocks));
|
||||
this.allStocks = this.originData.stocks.map((stock) => {
|
||||
let sectorIndex = -1;
|
||||
const stockSectors = Array.isArray(stock.sector_category) ? stock.sector_category : [stock.sector_category];
|
||||
@@ -263,28 +257,20 @@ const _sfc_main = {
|
||||
const formattedDate = this.selectedFullDate;
|
||||
const baseURL = request_http.getBaseURL1();
|
||||
const requestUrl = `${baseURL}/data/zt/daily/${formattedDate}.json?t=${timestamp}`;
|
||||
common_vendor.index.__f__("log", "at pagesStock/stockCenterDetails/bkydmx.vue:401", "请求URL:", requestUrl);
|
||||
common_vendor.index.__f__("log", "at pagesStock/stockCenterDetails/bkydmx.vue:390", "请求URL:", requestUrl);
|
||||
const res = await common_vendor.index.request({
|
||||
url: requestUrl,
|
||||
method: "GET"
|
||||
});
|
||||
if (res.statusCode === 200 && res.data) {
|
||||
this.originData = res.data;
|
||||
const chartData = this.originData.chart_data || {};
|
||||
const labels = chartData.labels || [];
|
||||
const counts = chartData.counts || [];
|
||||
const maxCount = counts.length > 0 ? Math.max(...counts) : 0;
|
||||
const maxLen = Math.min(labels.length, counts.length);
|
||||
let bkList = [];
|
||||
for (let i = 0; i < maxLen; i++) {
|
||||
const title = labels[i];
|
||||
const count = counts[i] || 0;
|
||||
bkList.push({
|
||||
title,
|
||||
count
|
||||
});
|
||||
}
|
||||
this.bkList = bkList;
|
||||
const { sector_data } = this.originData;
|
||||
this.bkList = Object.entries(sector_data).filter(([sectorName]) => sectorName !== "其他").map(([sectorName, sectorInfo]) => ({
|
||||
title: sectorName,
|
||||
codes: sectorInfo.stock_codes || []
|
||||
// 取板块对应的股票代码
|
||||
}));
|
||||
common_vendor.index.__f__("log", "at pagesStock/stockCenterDetails/bkydmx.vue:408", "生成板块列表:", this.bkList);
|
||||
this.setStockRoles();
|
||||
} else {
|
||||
common_vendor.index.showToast({
|
||||
@@ -293,7 +279,7 @@ const _sfc_main = {
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pagesStock/stockCenterDetails/bkydmx.vue:440", "请求异常:", error);
|
||||
common_vendor.index.__f__("error", "at pagesStock/stockCenterDetails/bkydmx.vue:418", "请求异常:", error);
|
||||
common_vendor.index.showToast({
|
||||
title: "网络异常",
|
||||
icon: "none"
|
||||
|
||||
Reference in New Issue
Block a user