From c9fc948cfa3cf91c072a13787aed5cb50fb31669 Mon Sep 17 00:00:00 2001 From: quanyawei <401863037@qq.com> Date: Mon, 15 Jan 2024 13:24:41 +0800 Subject: [PATCH] fix:bug修复 --- src/views/reportForm/sensorday.vue | 347 ++++++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 242 insertions(+), 105 deletions(-) diff --git a/src/views/reportForm/sensorday.vue b/src/views/reportForm/sensorday.vue index 2c55e91..250d527 100644 --- a/src/views/reportForm/sensorday.vue +++ b/src/views/reportForm/sensorday.vue @@ -12,7 +12,10 @@ style="width: 21rem" /> <div> - <el-radio-group v-model="select1" style="margin-left: 20px"> + <el-radio-group + v-model="select1" + style="margin-left: 20px" + > <el-radio-button label="������" /> <el-radio-button label="������" /> <el-radio-button label="������" /> @@ -22,8 +25,8 @@ <component :is="dataType" style="padding-left: 0; margin-left: 30px" - @sendPickerChild="showPickerChild" class="select11" + @sendPickerChild="showPickerChild" /> <el-date-picker v-if="dateDisplay" @@ -37,28 +40,46 @@ /> <el-button type="primary" - @click="getReportForm()" style="margin-left: 10px" - >������</el-button + @click="getReportForm()" > - <el-button type="primary" @click="exportExcel()">������������</el-button> + ������ + </el-button> + <el-button + type="primary" + @click="exportExcel()" + > + ������������ + </el-button> </div> </div> <div class="topTitle"> <el-table - :data="tableData" id="exportTabs" + :data="tableData" max-height="730" - @sort-change="changeTableSort" style="width: 100%" + @sort-change="changeTableSort" > - <el-table-column prop="name" label="������������" align="center"> - </el-table-column> - <el-table-column label="������������" align="center"> - <el-table-column prop="composite" label="������" align="center"> - <template slot-scope="scope">{{ - scope.row.composite !== 0 ? scope.row.composite : '--' - }}</template> + <el-table-column + prop="name" + label="������������" + align="center" + /> + <el-table-column + label="������������" + align="center" + > + <el-table-column + prop="composite" + label="������" + align="center" + > + <template slot-scope="scope"> + {{ + scope.row.composite !== 0 ? scope.row.composite : '--' + }} + </template> </el-table-column> <el-table-column label="������" @@ -66,93 +87,207 @@ prop="compositeNum" sortable > - <template slot-scope="scope">{{ - scope.row.compositeNum !== 0 ? scope.row.compositeNum : '--' - }}</template> + <template slot-scope="scope"> + {{ + scope.row.compositeNum !== 0 ? scope.row.compositeNum : '--' + }} + </template> </el-table-column> </el-table-column> - <el-table-column label="PM2.5" align="center"> - <el-table-column prop="pm25" label="������" align="center"> - <template slot-scope="scope">{{ - scope.row.pm25 !== 0 ? scope.row.pm25 : '--' - }}</template> + <el-table-column + label="PM2.5" + align="center" + > + <el-table-column + prop="pm25" + label="������" + align="center" + > + <template slot-scope="scope"> + {{ + scope.row.pm25 !== 0 ? scope.row.pm25 : '--' + }} + </template> </el-table-column> - <el-table-column label="������" align="center" prop="pm25Num" sortable> - <template slot-scope="scope">{{ - scope.row.pm25Num !== 0 ? scope.row.pm25Num : '--' - }}</template> + <el-table-column + label="������" + align="center" + prop="pm25Num" + sortable + > + <template slot-scope="scope"> + {{ + scope.row.pm25Num !== 0 ? scope.row.pm25Num : '--' + }} + </template> </el-table-column> </el-table-column> - <el-table-column label="PM10" align="center"> - <el-table-column prop="pm10" label="������" align="center"> - <template slot-scope="scope">{{ - scope.row.pm10 !== 0 ? scope.row.pm10 : '--' - }}</template> + <el-table-column + label="PM10" + align="center" + > + <el-table-column + prop="pm10" + label="������" + align="center" + > + <template slot-scope="scope"> + {{ + scope.row.pm10 !== 0 ? scope.row.pm10 : '--' + }} + </template> </el-table-column> - <el-table-column label="������" align="center" prop="pm10Num" sortable> - <template slot-scope="scope">{{ - scope.row.pm10Num !== 0 ? scope.row.pm10Num : '--' - }}</template> + <el-table-column + label="������" + align="center" + prop="pm10Num" + sortable + > + <template slot-scope="scope"> + {{ + scope.row.pm10Num !== 0 ? scope.row.pm10Num : '--' + }} + </template> </el-table-column> </el-table-column> - <el-table-column label="SO2" align="center"> - <el-table-column prop="so2" label="������" align="center"> - <template slot-scope="scope">{{ - scope.row.so2 !== 0 ? scope.row.so2 : '--' - }}</template> + <el-table-column + label="SO2" + align="center" + > + <el-table-column + prop="so2" + label="������" + align="center" + > + <template slot-scope="scope"> + {{ + scope.row.so2 !== 0 ? scope.row.so2 : '--' + }} + </template> </el-table-column> - <el-table-column label="������" align="center" prop="so2Num" sortable> - <template slot-scope="scope">{{ - scope.row.so2Num !== 0 ? scope.row.so2Num : '--' - }}</template> + <el-table-column + label="������" + align="center" + prop="so2Num" + sortable + > + <template slot-scope="scope"> + {{ + scope.row.so2Num !== 0 ? scope.row.so2Num : '--' + }} + </template> </el-table-column> </el-table-column> - <el-table-column label="NO2" align="center"> - <el-table-column prop="no2" label="������" align="center"> - <template slot-scope="scope">{{ - scope.row.no2 !== 0 ? scope.row.no2 : '--' - }}</template> + <el-table-column + label="NO2" + align="center" + > + <el-table-column + prop="no2" + label="������" + align="center" + > + <template slot-scope="scope"> + {{ + scope.row.no2 !== 0 ? scope.row.no2 : '--' + }} + </template> </el-table-column> - <el-table-column label="������" align="center" prop="no2Num" sortable> - <template slot-scope="scope">{{ - scope.row.no2Num !== 0 ? scope.row.no2Num : '--' - }}</template> + <el-table-column + label="������" + align="center" + prop="no2Num" + sortable + > + <template slot-scope="scope"> + {{ + scope.row.no2Num !== 0 ? scope.row.no2Num : '--' + }} + </template> </el-table-column> </el-table-column> - <el-table-column label="CO" align="center"> - <el-table-column prop="co" label="������" align="center"> - <template slot-scope="scope">{{ - scope.row.co !== 0 ? scope.row.co : '--' - }}</template> + <el-table-column + label="CO" + align="center" + > + <el-table-column + prop="co" + label="������" + align="center" + > + <template slot-scope="scope"> + {{ + scope.row.co !== 0 ? scope.row.co : '--' + }} + </template> </el-table-column> - <el-table-column label="������" align="center" prop="conum" sortable> - <template slot-scope="scope">{{ - scope.row.conum !== 0 ? scope.row.conum : '--' - }}</template> + <el-table-column + label="������" + align="center" + prop="conum" + sortable + > + <template slot-scope="scope"> + {{ + scope.row.conum !== 0 ? scope.row.conum : '--' + }} + </template> </el-table-column> </el-table-column> - <el-table-column label="O3" align="center"> - <el-table-column prop="o3" label="������" align="center"> - <template slot-scope="scope">{{ - scope.row.o3 !== 0 ? scope.row.o3 : '--' - }}</template> + <el-table-column + label="O3" + align="center" + > + <el-table-column + prop="o3" + label="������" + align="center" + > + <template slot-scope="scope"> + {{ + scope.row.o3 !== 0 ? scope.row.o3 : '--' + }} + </template> </el-table-column> - <el-table-column label="������" align="center" prop="o3Num" sortable> - <template slot-scope="scope">{{ - scope.row.o3Num !== 0 ? scope.row.o3Num : '--' - }}</template> + <el-table-column + label="������" + align="center" + prop="o3Num" + sortable + > + <template slot-scope="scope"> + {{ + scope.row.o3Num !== 0 ? scope.row.o3Num : '--' + }} + </template> </el-table-column> </el-table-column> - <el-table-column label="TVOC" align="center"> - <el-table-column prop="tovc" label="������" align="center"> - <template slot-scope="scope">{{ - scope.row.tovc !== 0 ? scope.row.tovc : '--' - }}</template> + <el-table-column + label="TVOC" + align="center" + > + <el-table-column + prop="tovc" + label="������" + align="center" + > + <template slot-scope="scope"> + {{ + scope.row.tovc !== 0 ? scope.row.tovc : '--' + }} + </template> </el-table-column> - <el-table-column label="������" align="center" prop="tovcnum" sortable> - <template slot-scope="scope">{{ - scope.row.tovcnum !== 0 ? scope.row.tovcnum : '--' - }}</template> + <el-table-column + label="������" + align="center" + prop="tovcnum" + sortable + > + <template slot-scope="scope"> + {{ + scope.row.tovcnum !== 0 ? scope.row.tovcnum : '--' + }} + </template> </el-table-column> </el-table-column> </el-table> @@ -187,7 +322,7 @@ weekPicker, }, props: {}, - data() { + data () { // ������������������ return { newData: [], @@ -222,7 +357,7 @@ computed: {}, // ������data������������������ watch: { - select1(nv, ov) { + select1 (nv, ov) { if (nv === '������') { this.dataType = 'HourPicker' this.unit = 1 @@ -242,7 +377,7 @@ this.dateDisplay = false } }, - newMac(newVal, oldval) { + newMac (newVal, oldval) { this.newMac1 = [] for (let i = 0; i < newVal.length; i++) { // console.log(newVal[i], 111) @@ -253,25 +388,25 @@ }, // ������������ - ��������������������������������� this ��������� - created() { + created () { this.getData() }, // ������������ - ��������������������������� DOM ��������� - mounted() {}, - beforeCreate() {}, // ������������ - ������������ - beforeMount() {}, // ������������ - ������������ - beforeUpdate() {}, // ������������ - ������������ - updated() {}, // ������������ - ������������ - beforeDestroy() {}, // ������������ - ������������ - destroyed() {}, // ������������ - ������������ - activated() {}, + mounted () {}, + beforeCreate () {}, // ������������ - ������������ + beforeMount () {}, // ������������ - ������������ + beforeUpdate () {}, // ������������ - ������������ + updated () {}, // ������������ - ������������ + beforeDestroy () {}, // ������������ - ������������ + destroyed () {}, // ������������ - ������������ + activated () {}, // ������������ methods: { - showPickerChild(data) { + showPickerChild (data) { this.newData = data }, // ������������rank������(���������������������������������������������������������������) - changeTableSort() { + changeTableSort () { var sortTableData = this.$refs.mytable.tableData // console.log(this.$refs.mytable.tableData, 111) for (let i = 0; i < sortTableData.length; i++) { @@ -280,7 +415,7 @@ }, // ������������ - exportExcel() { + exportExcel () { /* generate workbook object from table */ var xlsxParam = { raw: true } // ��������������������������������������������������� var wb = XLSX.utils.table_to_book( @@ -307,7 +442,7 @@ return wbout }, // ������������������ - getData() { + getData () { this.$request({ url: '/monitorPoint/queryMonitorPoints', method: 'get', @@ -325,14 +460,16 @@ label: this.defaultData[i].name, }) this.options[i].children = [] - for (let j = 0; j < this.defaultData[i].devices.length; j++) { - this.options[i].children.push({ - value: [ - this.defaultData[i].devices[j].name, - this.defaultData[i].devices[j].mac, - ], - label: this.defaultData[i].devices[j].name, - }) + if (this.defaultData[i].devices) { + for (let j = 0; j < this.defaultData[i].devices.length; j++) { + this.options[i].children.push({ + value: [ + this.defaultData[i].devices[j].name, + this.defaultData[i].devices[j].mac, + ], + label: this.defaultData[i].devices[j].name, + }) + } } } }) @@ -341,7 +478,7 @@ }) }, // ������������������ - getReportForm() { + getReportForm () { console.log(this.newData) this.$request({ // url: '/monitorPoint/listMonitoring', -- Gitblit v1.8.0