diff --git a/src/views/core/analysis/balanceAnalysis/index.vue b/src/views/core/analysis/balanceAnalysis/index.vue index 8ce3b630..1898ec7b 100644 --- a/src/views/core/analysis/balanceAnalysis/index.vue +++ b/src/views/core/analysis/balanceAnalysis/index.vue @@ -11,10 +11,9 @@ @tab-click="handleTabClick" style="height: 100%"> - - - - @@ -98,6 +93,11 @@ export default { startTime: null, endTime: null, }, + sectionMap: {}, + lastSection: null, + currRowIndex: 0, + spanArr: [], + ready: false, }; }, @@ -156,8 +156,11 @@ export default { const { data, nameData } = await this.getCT(); await this.buildProps(nameData); await this.buildTableData(data); - const xxxx = this.tableData; - debugger; + this.tableData = this.tableData.sort((a, b) => { + if (a.sectionName < b.sectionName) return 1; + return -1; + }); + this.ready = true; }, buildProps(nameData) { @@ -208,38 +211,60 @@ export default { }, async buildTableData(data) { - /** 处理 工段 分组 */ - const sectionList = data.map((item) => {}); - }, + const sectionArr = Array.from( + new Set(data.map((item) => item.sectionName)) + ).sort(); + this.sectionMap = sectionArr.reduce( + (sum, curr) => ({ ...sum, [curr]: 0 }), + {} + ); + this.spanArr = Array.from(sectionArr, () => 0); - setRowSpan(arr) { - let count = 0; - arr.forEach((item, index) => { - if (index === 0) { - this.spanArr.push(1); - } else { - if (item === arr[index - 1]) { - this.spanArr[count] += 1; - this.spanArr.push(0); - } else { - count = index; - this.spanArr.push(1); - } + return new Promise((resolve, reject) => { + /** 处理 工段 分组 */ + data.map((item) => { + this.sectionMap[item.sectionName]++; + /** 处理 设备 */ + const row = { + equName: item.equName, + sectionName: item.sectionName, + }; + item.data.forEach((eq) => { + const date = eq.dynamicName; + eq.children.forEach((sub) => { + if (sub.dynamicName == '设备CT') + row[date + '_eq_ct'] = sub.dynamicValue; + if (sub.dynamicName == '设备TT') + row[date + '_eq_tt'] = sub.dynamicValue; + if (sub.dynamicName == '产线CT') + row[date + '_pl_ct'] = sub.dynamicValue; + if (sub.dynamicName == '产线TT') + row[date + '_pl_tt'] = sub.dynamicValue; + }); + }); + this.tableData.push(row); + }); + + /** 生成span数组 */ + const tmp = [0]; + for (const [index, key] of sectionArr.entries()) { + tmp[index + 1] = tmp[index] + this.sectionMap[key]; } + + console.log('tep', tmp); + this.spanArr = tmp; + resolve(); }); }, - /** 合并table列的规则 */ - mergeColumnHandler({ row, column, rowIndex, columnIndex }) { - if (columnIndex == 0) { - if (this.spanArr[rowIndex]) { - return [ - this.spanArr[rowIndex], // row span - 1, // col span - ]; - } else { - return [0, 0]; + mergeRow({ row, column, rowIndex, columnIndex }) { + if (columnIndex == 1) { + const span = this.sectionMap[row.sectionName]; + if (this.spanArr.includes(rowIndex)) { + console.log('span...'); + return [span, 1]; } + return [0, 0]; } }, @@ -319,6 +344,7 @@ export default { // this.dataListLoading = false; }); }, + handleSearchBarBtnClick(btn) { switch (btn.btnName) { case 'search': diff --git a/src/views/monitoring/equipmentProcessAmount/index.vue b/src/views/monitoring/equipmentProcessAmount/index.vue index 0848b288..d61257dc 100644 --- a/src/views/monitoring/equipmentProcessAmount/index.vue +++ b/src/views/monitoring/equipmentProcessAmount/index.vue @@ -33,7 +33,7 @@ :data-value="fc.id" class="factory-list__item" :class="{ 'is-current': fc.id == currentFactory?.id }"> - + {{ fc.label }} -
+