From b760e4eea2fc4f56347ac26ca8bde97b15e164e5 Mon Sep 17 00:00:00 2001 From: quanyawei <401863037@qq.com> Date: Mon, 09 Oct 2023 09:25:24 +0800 Subject: [PATCH] Merge branch 'feature_1.0' --- src/views/air/index.vue | 1203 +++++++++++++++++++++++++++++--------------------------- 1 files changed, 620 insertions(+), 583 deletions(-) diff --git a/src/views/air/index.vue b/src/views/air/index.vue index f844cdc..e01af93 100644 --- a/src/views/air/index.vue +++ b/src/views/air/index.vue @@ -1,144 +1,186 @@ <template> <div class="analyseAir"> -<!-- ������--> + <!-- ������--> <div class="exTop"> <div class="cascader-demo"> <el-select v-model="value" clearable placeholder="���������������"> <el-option - v-for="item in options" - :key="item.value" - :label="item.label" - :value="item.value"> + v-for="item in options" + :key="item.value" + :label="item.label" + :value="item.value" + > </el-option> </el-select> </div> <el-date-picker - v-model="value3" - style="margin-right: 5%" - align="right" - type="date" - placeholder="������������"> + v-model="value3" + style="margin-right: 5%" + align="right" + type="date" + placeholder="������������" + > </el-date-picker> <el-upload - v-if="value==='gx'" - class="upload-demo" - ref="upload1" - action="" - accept="xlsx" - :on-change="handleChange" - :on-remove="handleRemove" - :file-list="fileList" - :limit="1" - :on-exceed="handleExceed" - multiple - :auto-upload="false"> - <el-button slot="trigger" type="primary" size="small">������������</el-button> - <div slot="tip" class="el-upload__tip" v-if="value==='gx'">������������������������������</div> + v-if="value === 'gx'" + class="upload-demo" + ref="upload1" + action="" + accept="xlsx" + :on-change="handleChange" + :on-remove="handleRemove" + :file-list="fileList" + :limit="1" + :on-exceed="handleExceed" + multiple + :auto-upload="false" + > + <el-button slot="trigger" type="primary" size="small" + >������������</el-button + > + <div slot="tip" class="el-upload__tip" v-if="value === 'gx'"> + ������������������������������ + </div> <div slot="tip" class="el-upload__tip" v-else></div> </el-upload> <el-upload - v-if="value==='gx'" - class="upload-demo" - ref="upload2" - action="" - accept="xlsx" - :on-change="handleChange2" - :on-remove="handleRemove2" - :file-list="fileList2" - :limit="1" - :on-exceed="handleExceed" - multiple - :auto-upload="false"> - <el-button slot="trigger" type="primary" size="small">������������</el-button> - <div slot="tip" class="el-upload__tip" v-if="value==='gx'">���������������������������</div> + v-if="value === 'gx'" + class="upload-demo" + ref="upload2" + action="" + accept="xlsx" + :on-change="handleChange2" + :on-remove="handleRemove2" + :file-list="fileList2" + :limit="1" + :on-exceed="handleExceed" + multiple + :auto-upload="false" + > + <el-button slot="trigger" type="primary" size="small" + >������������</el-button + > + <div slot="tip" class="el-upload__tip" v-if="value === 'gx'"> + ��������������������������� + </div> <div slot="tip" class="el-upload__tip" v-else></div> </el-upload> <el-upload - v-if="value==='gx'" - class="upload-demo" - ref="upload3" - action="" - accept="xlsx" - :on-change="handleChange3" - :on-remove="handleRemove3" - :file-list="fileList3" - :limit="1" - :on-exceed="handleExceed" - multiple - :auto-upload="false"> - <el-button slot="trigger" type="primary" size="small">������������</el-button> - <div slot="tip" class="el-upload__tip" v-if="value==='gx'">���������������������������</div> + v-if="value === 'gx'" + class="upload-demo" + ref="upload3" + action="" + accept="xlsx" + :on-change="handleChange3" + :on-remove="handleRemove3" + :file-list="fileList3" + :limit="1" + :on-exceed="handleExceed" + multiple + :auto-upload="false" + > + <el-button slot="trigger" type="primary" size="small" + >������������</el-button + > + <div slot="tip" class="el-upload__tip" v-if="value === 'gx'"> + ��������������������������� + </div> <div slot="tip" class="el-upload__tip" v-else></div> </el-upload> <el-upload - v-if="value==='gx'" - class="upload-demo" - ref="upload4" - action="" - accept="xlsx" - :on-change="handleChange4" - :on-remove="handleRemove4" - :file-list="fileList4" - :limit="1" - :on-exceed="handleExceed" - multiple - :auto-upload="false"> - <el-button slot="trigger" type="primary" size="small">������������</el-button> - <div slot="tip" class="el-upload__tip" v-if="value==='gx'">������������������������������</div> + v-if="value === 'gx'" + class="upload-demo" + ref="upload4" + action="" + accept="xlsx" + :on-change="handleChange4" + :on-remove="handleRemove4" + :file-list="fileList4" + :limit="1" + :on-exceed="handleExceed" + multiple + :auto-upload="false" + > + <el-button slot="trigger" type="primary" size="small" + >������������</el-button + > + <div slot="tip" class="el-upload__tip" v-if="value === 'gx'"> + ������������������������������ + </div> <div slot="tip" class="el-upload__tip" v-else></div> </el-upload> <el-upload - v-if="value==='gx'" - class="upload-demo" - ref="upload5" - action="" - accept="xlsx" - :on-change="handleChange5" - :on-remove="handleRemove5" - :file-list="fileList5" - :limit="1" - :on-exceed="handleExceed" - multiple - :auto-upload="false"> - <el-button slot="trigger" type="primary" size="small">������������</el-button> - <div slot="tip" class="el-upload__tip" v-if="value==='gx'">������������������������</div> + v-if="value === 'gx'" + class="upload-demo" + ref="upload5" + action="" + accept="xlsx" + :on-change="handleChange5" + :on-remove="handleRemove5" + :file-list="fileList5" + :limit="1" + :on-exceed="handleExceed" + multiple + :auto-upload="false" + > + <el-button slot="trigger" type="primary" size="small" + >������������</el-button + > + <div slot="tip" class="el-upload__tip" v-if="value === 'gx'"> + ������������������������ + </div> <div slot="tip" class="el-upload__tip" v-else></div> </el-upload> <el-upload - v-if="value==='gx'" - class="upload-demo" - ref="upload6" - action="" - accept="xlsx" - :on-change="handleChange6" - :on-remove="handleRemove6" - :file-list="fileList6" - :limit="1" - :on-exceed="handleExceed" - multiple - :auto-upload="false"> - <el-button slot="trigger" type="primary" size="small">������������</el-button> + v-if="value === 'gx'" + class="upload-demo" + ref="upload6" + action="" + accept="xlsx" + :on-change="handleChange6" + :on-remove="handleRemove6" + :file-list="fileList6" + :limit="1" + :on-exceed="handleExceed" + multiple + :auto-upload="false" + > + <el-button slot="trigger" type="primary" size="small" + >������������</el-button + > <div slot="tip" class="el-upload__tip">������������������������������</div> </el-upload> - <div v-if="value==='hn'" style="position: relative"> + <div v-if="value === 'hn'" style="position: relative"> <el-upload - class="upload-demo" - ref="upload7" - action="" - accept="xlsx" - :on-change="handleChange7" - :on-remove="handleRemove7" - :file-list="fileList7" - :limit="1" - :on-exceed="handleExceed" - multiple - :auto-upload="false"> - <el-button slot="trigger" type="primary" size="small">������������</el-button> - <div slot="tip" class="el-upload__tip">������������������������������������������AQI������</div> + class="upload-demo" + ref="upload7" + action="" + accept="xlsx" + :on-change="handleChange7" + :on-remove="handleRemove7" + :file-list="fileList7" + :limit="1" + :on-exceed="handleExceed" + multiple + :auto-upload="false" + > + <el-button slot="trigger" type="primary" size="small" + >������������</el-button + > + <div slot="tip" class="el-upload__tip"> + ������������������������������������������AQI������ + </div> </el-upload> - <el-button type="success" @click="submitUpload" :disabled="idDisabled" size="small" style="position: absolute;right: 20%;bottom: -100%">������������</el-button> + <el-button + type="success" + @click="submitUpload" + :disabled="idDisabled" + size="small" + style="position: absolute; right: 20%; bottom: -100%" + >������������</el-button + > </div> -<!-- <el-upload + <!-- <el-upload v-if="value==='gx'" class="upload-demo" ref="upload8" @@ -154,40 +196,51 @@ <el-button slot="trigger" type="primary" size="small">������������</el-button> <div slot="tip" class="el-upload__tip">������������</div> </el-upload>--> -<!-- <div style="position: absolute; bottom: 2%; right: 20%">--> - <div style="position: absolute; right: 20%"> - <el-button v-if="value==='gx'" type="success" @click="submitUpload" size="small">������������</el-button> -<!-- <el-button type="primary" @click="exportReport" size="small">������������</el-button>--> + <!-- <div style="position: absolute; bottom: 2%; right: 20%">--> + <div style="position: absolute; right: 20%; padding-top: 20px"> + <el-button + v-if="value === 'gx'" + type="success" + @click="submitUpload" + size="small" + >������������</el-button + > </div> </div> <div class="exDown"> <el-card class="box-card" style="position: relative"> - <div class="block" style="margin-bottom: 30px;"> + <div class="block" style="margin-bottom: 30px"> <el-date-picker - v-model="value2" - type="daterange" - align="right" - unlink-panels - range-separator="���" - start-placeholder="������������" - end-placeholder="������������" - :picker-options="pickerOptions"> + v-model="value2" + type="daterange" + align="right" + unlink-panels + range-separator="���" + start-placeholder="������������" + end-placeholder="������������" + :picker-options="pickerOptions" + > </el-date-picker> <el-select v-model="valueSelect" clearable placeholder="���������������"> <el-option - v-for="item in optionsSelect" - :key="item.valueSelect" - :label="item.label" - :value="item.valueSelect"> + v-for="item in optionsSelect" + :key="item.valueSelect" + :label="item.label" + :value="item.valueSelect" + > </el-option> </el-select> - <el-button type="primary" @click="selectReport(1)" size="small" class="selectBtn">������</el-button> -<!-- <el-button type="primary" @click="selectReport" size="small" class="selectBtn">������������</el-button>--> + <el-button + type="primary" + @click="selectReport(1)" + size="small" + class="selectBtn" + >������</el-button + > + <!-- <el-button type="primary" @click="selectReport" size="small" class="selectBtn">������������</el-button>--> </div> - <div style="overflow-y: auto; height: 82%;margin-bottom: 2%;"> - <el-table - :data="tableData" - style="width: 100%"> + <div style="overflow-y: auto; height: 82%; margin-bottom: 2%"> + <el-table :data="tableData" style="width: 100%"> <!-- <el-table-column width="100" align="center"> @@ -203,41 +256,48 @@ @change="handleCheckOneChange(scope.row)"></el-checkbox> </template> </el-table-column>--> - <el-table-column - prop="name" - label="������������" - > - </el-table-column> - <el-table-column - prop="time" - label="������������" - > - </el-table-column> - <el-table-column - prop="date" - label="������������" - > - </el-table-column> + <el-table-column prop="name" label="������������"> </el-table-column> + <el-table-column prop="time" label="������������"> </el-table-column> + <el-table-column prop="date" label="������������"> </el-table-column> <el-table-column label="������"> <template slot-scope="scope"> - <el-button type="text" size="medium" v-if="valueSelect==='gx'" @click="expReport(scope.row)">������</el-button> + <el-button + type="text" + size="medium" + v-if="valueSelect === 'gx'" + @click="expReport(scope.row)" + >������</el-button + > <!--������excel--> - <img src="../../assets/icon/hn_excel.png" alt="������������excel" v-if="valueSelect==='hn'" @click="hnExcel(scope.row)" style="margin-left:0; cursor:pointer;"> + <img + src="../../assets/icon/hn_excel.png" + alt="������������excel" + v-if="valueSelect === 'hn'" + @click="hnExcel(scope.row)" + style="margin-left: 0; cursor: pointer" + /> <!--������word --> - <img src="../../assets/icon/hn_word.png" alt="���������������������������������" v-if="valueSelect==='hn'" @click="hnExpReport(scope.row)" style="cursor:pointer;"> + <img + src="../../assets/icon/hn_word.png" + alt="���������������������������������" + v-if="valueSelect === 'hn'" + @click="hnExpReport(scope.row)" + style="cursor: pointer" + /> </template> </el-table-column> </el-table> </div> <div class="block" v-if="isDisplay"> <el-pagination - background - @size-change="handleSizeChange" - @current-change="handleCurrentChange" - :current-page.sync="currentPage3" - :page-size="onePageCount" - layout="total, prev, pager, next, jumper" - :total="totalNumber"> + background + @size-change="handleSizeChange" + @current-change="handleCurrentChange" + :current-page.sync="currentPage3" + :page-size="onePageCount" + layout="total, prev, pager, next, jumper" + :total="totalNumber" + > </el-pagination> </div> </el-card> @@ -267,42 +327,47 @@ file7: null, file8: null, pickerOptions: { - shortcuts: [{ - text: '������������', - onClick(picker) { - const end = new Date() - const start = new Date() - start.setTime(start.getTime() - 3600 * 1000 * 24 * 7) - picker.$emit('pick', [start, end]) - } - }, { - text: '���������������', - onClick(picker) { - const end = new Date() - const start = new Date() - start.setTime(start.getTime() - 3600 * 1000 * 24 * 30) - picker.$emit('pick', [start, end]) - } - }, { - text: '���������������', - onClick(picker) { - const end = new Date() - const start = new Date() - start.setTime(start.getTime() - 3600 * 1000 * 24 * 90) - picker.$emit('pick', [start, end]) - } - }] + shortcuts: [ + { + text: '������������', + onClick(picker) { + const end = new Date() + const start = new Date() + start.setTime(start.getTime() - 3600 * 1000 * 24 * 7) + picker.$emit('pick', [start, end]) + }, + }, + { + text: '���������������', + onClick(picker) { + const end = new Date() + const start = new Date() + start.setTime(start.getTime() - 3600 * 1000 * 24 * 30) + picker.$emit('pick', [start, end]) + }, + }, + { + text: '���������������', + onClick(picker) { + const end = new Date() + const start = new Date() + start.setTime(start.getTime() - 3600 * 1000 * 24 * 90) + picker.$emit('pick', [start, end]) + }, + }, + ], }, value2: [new Date(), new Date()], // ������������������������ value3: new Date(), // ��������������������������� options: [ { value: 'hn', - label: '���������' - }, { + label: '���������', + }, + { value: 'gx', - label: '���������' - } + label: '���������', + }, ], value: 'gx', // ������ valueSelect: 'gx', @@ -310,11 +375,12 @@ optionsSelect: [ { valueSelect: 'hn', - label: '���������' - }, { + label: '���������', + }, + { valueSelect: 'gx', - label: '���������' - } + label: '���������', + }, ], tableData: [], sensorTime: [], // ��������������������� @@ -332,7 +398,7 @@ currentPage3: 1, // ��������������� totalNumber: 0, // ��������� onePageCount: 8, // ��������������� - isDisplay: false // ������������������ + isDisplay: false, // ������������������ } }, watch: { @@ -343,7 +409,7 @@ }, valueSelect(newName, oldName) { this.tableData = [] - } + }, }, methods: { // ������ @@ -356,8 +422,11 @@ }, // ������ handleChange(file, fileList) { - if (file.raw.type !== 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') { - this.$refs.upload.handleRemove(file) + if ( + file.raw.type !== + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' + ) { + this.$refs.upload1.handleRemove(file) this.$message.warning(`���������������������������`) return } @@ -369,7 +438,10 @@ this.file1 = fileList[0] }, handleChange2(file, fileList) { - if (file.raw.type !== 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') { + if ( + file.raw.type !== + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' + ) { this.$refs.upload2.handleRemove(file) this.$message.warning(`���������������������������`) return @@ -382,7 +454,10 @@ this.file2 = fileList[0] }, handleChange3(file, fileList) { - if (file.raw.type !== 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') { + if ( + file.raw.type !== + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' + ) { this.$refs.upload3.handleRemove(file) this.$message.warning(`���������������������������`) return @@ -395,7 +470,10 @@ this.file3 = fileList[0] }, handleChange4(file, fileList) { - if (file.raw.type !== 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') { + if ( + file.raw.type !== + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' + ) { this.$refs.upload4.handleRemove(file) this.$message.warning(`���������������������������`) return @@ -408,7 +486,10 @@ this.file4 = fileList[0] }, handleChange5(file, fileList) { - if (file.raw.type !== 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') { + if ( + file.raw.type !== + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' + ) { this.$refs.upload5.handleRemove(file) this.$message.warning(`���������������������������`) return @@ -421,7 +502,11 @@ this.file5 = fileList[0] }, handleChange6(file, fileList) { - if (file.raw.type !== 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' && file.raw.type !== 'application/vnd.ms-excel') { + if ( + file.raw.type !== + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' && + file.raw.type !== 'application/vnd.ms-excel' + ) { this.$refs.upload6.handleRemove(file) this.$message.warning(`���������������������������`) return @@ -434,7 +519,11 @@ this.file6 = fileList[0] }, handleChange7(file, fileList) { - if (file.raw.type !== 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' && file.raw.type !== 'application/vnd.ms-excel') { + if ( + file.raw.type !== + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' && + file.raw.type !== 'application/vnd.ms-excel' + ) { this.$refs.upload7.handleRemove(file) this.$message.warning(`���������������������������`) return @@ -447,26 +536,39 @@ this.file7 = fileList[0] }, handleExceed(files, fileList) { - this.$message.warning(`������������������ 1 ��������������������������� ${files.length} ������������������������ ${files.length + fileList.length} ���������`) + this.$message.warning( + `������������������ 1 ��������������������������� ${files.length} ������������������������ ${ + files.length + fileList.length + } ���������` + ) }, submitUpload() { this.formData2 = [] if (!this.value3) { this.$message({ message: '���������������', - type: 'warning' + type: 'warning', }) return } - if (this.value === 'gx') { // ��������������������� + if (this.value === 'gx') { + // ��������������������� this.gxSubmit() - } else { // ��������������������� + } else { + // ��������������������� this.hnSubmit() } }, // ��������������������������� gxSubmit() { - if (this.file1 && this.file2 && this.file3 && this.file4 && this.file5 && this.file6) { + if ( + this.file1 && + this.file2 && + this.file3 && + this.file4 && + this.file5 && + this.file6 + ) { const formData = new FormData() formData.append(`code`, this.value) this.sensorTime = this.newTime(this.value3, 'submit') @@ -483,20 +585,24 @@ // formData.append(`file7`, this.file7.raw) // formData.append(`file8`, this.file8.raw) // ������������������ - this.MultipartFile(formData).then(res => { - if (res.code === 0) { - var reportInfo = res.data - this.value2 = [this.value3, this.value3] - reportInfo.name = '���������������������������������' + reportInfo.time.split('-').join('') - this.tableData = [reportInfo] - } - }).catch(err => { - console.log(err) - }) + this.MultipartFile(formData) + .then((res) => { + if (res.code === 0) { + var reportInfo = res.data + this.value2 = [this.value3, this.value3] + reportInfo.name = + '���������������������������������������' + + reportInfo.time.split('-').join('') + this.tableData = [reportInfo] + } + }) + .catch((err) => { + console.log(err) + }) } else { this.$message({ message: '���������������������������', - type: 'warning' + type: 'warning', }) } }, @@ -512,27 +618,30 @@ formData.append(`date`, date) formData.append(`files`, this.file7.raw) // ������������������ - this.MultipartFile(formData).then(res => { - this.idDisabled = false - if (res.code === 0) { - this.$message({ - message: '���������������', - type: 'success' - }) - var reportInfo = res.data - this.value2 = [this.value3, this.value3] - reportInfo.name = '���������������' + reportInfo.time.split('-').join('') - this.tableData = [reportInfo] - } else { - this.$message.error('���������������') - } - }).catch(err => { - console.log(err) - }) + this.MultipartFile(formData) + .then((res) => { + this.idDisabled = false + if (res.code === 0) { + this.$message({ + message: '���������������', + type: 'success', + }) + var reportInfo = res.data + this.value2 = [this.value3, this.value3] + reportInfo.name = + '���������������' + reportInfo.time.split('-').join('') + this.tableData = [reportInfo] + } else { + this.$message.error('���������������') + } + }) + .catch((err) => { + console.log(err) + }) } else { this.$message({ message: '���������������������������', - type: 'warning' + type: 'warning', }) } }, @@ -544,14 +653,14 @@ url: '/excel/excelImport', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, // ��������������������������������� - data + data, }) } else { return this.$request({ url: '/excel/syExcelImport', method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, // ��������������������������������� - data + data, }) } }, @@ -567,7 +676,7 @@ return y + '-' + m + '-' + d } else { var arr = [] - timeArr.map(v => { + timeArr.map((v) => { var date = new Date(v) var y = date.getFullYear() var m = date.getMonth() + 1 @@ -598,7 +707,7 @@ handleCheckAllChange(val) { // console.info('check all change is ', val) this.isIndeterminate = false - this.tableData.forEach(item => { + this.tableData.forEach((item) => { item.checked = val this.dateArr.push(item.date) }) @@ -613,7 +722,7 @@ handleCheckOneChange(obj) { // console.info('check one change is ', obj) if (obj.checked === false) { - this.dateArr = this.dateArr.filter(v => { + this.dateArr = this.dateArr.filter((v) => { return v !== obj.date }) } else { @@ -621,13 +730,14 @@ } var totalCount = this.tableData.length let someStatusCount = 0 - this.tableData.forEach(item => { + this.tableData.forEach((item) => { if (item.checked === obj.checked) { someStatusCount++ } }) this.count = someStatusCount - this.checkAll = totalCount === someStatusCount ? obj.checked : !obj.checked + this.checkAll = + totalCount === someStatusCount ? obj.checked : !obj.checked this.isIndeterminate = someStatusCount > 0 && someStatusCount < totalCount }, // ��������������������� @@ -636,58 +746,82 @@ url: '/excel/excelExport', method: 'get', params: { - id: obj.id - } - }).then(res => { - var getData = {} - getData = res.data - // ��������������������� - getData.list1 = this.cityLast(getData.list1) - getData.list5 = this.cityLast(getData.list5) - // ��������������������� - getData.list2 = this.cityFirst(getData.list2) - getData.list3 = this.cityFirst(getData.list3) - getData.list4 = this.cityFirst(getData.list4) - this.airData = getData - var monthZero = res.data.time.split('���')[0] - if (monthZero.substr(0, 1) === '0') { - this.airData.month = monthZero.substr(1) - } else { - this.airData.month = res.data.time.split('���')[0] - } - var dayZero = res.data.time.split('���')[1].split('���')[0] - if (dayZero.substr(0, 1) === '0') { - this.airData.day = dayZero.substr(1) - } else { - this.airData.day = dayZero - } - var arr = obj.date.split('-') - if (arr[2].substr(0, 1) === '0') { - arr[2] = arr[2].substr(1) - } - if (arr[1].substr(0, 1) === '0') { - arr[1] = arr[1].substr(1) - } - this.airData.currentTime = arr[0] + '���' + arr[1] + '���' + arr[2] + '���' - this.airData.currentYear = arr[0] - var time1DayZero = '' - var time1MonthZero = '' - if (res.data.time1.split('���')[1].split('���')[0].substr(0, 1) === '0') { - time1MonthZero = res.data.time1.split('���')[1].split('���')[0].substr(1) - } else { - time1MonthZero = res.data.time1.split('���')[1].split('���')[0] - } - - if (res.data.time1.split('���')[1].split('���')[0].substr(0, 1) === '0') { - time1DayZero = res.data.time1.split('���')[1].split('���')[0].substr(1) - } else { - time1DayZero = res.data.time1.split('���')[1].split('���')[0] - } - this.airData.time1 = res.data.time1.split('���')[0] + '���' + time1MonthZero + '���' + time1DayZero + '���' - ExportBriefDataDocx('/airQuality.docx', this.airData, `${obj.name}.docx`) - }).catch(err => { - console.log(err) + id: obj.id, + }, }) + .then((res) => { + console.log(res, 'xia') + var getData = {} + getData = res.data + // ��������������������� + getData.list1 = this.cityLast(getData.list1) + getData.list5 = this.cityLast(getData.list5) + // ���������/��������������������� + getData.list2 = this.cityFirst2(getData.list2) + getData.list3 = this.cityFirst2(getData.list3) + getData.list4 = this.cityFirst(getData.list4) + this.airData = getData + var monthZero = res.data.time.split('���')[0] + if (monthZero.substr(0, 1) === '0') { + this.airData.month = monthZero.substr(1) + } else { + this.airData.month = res.data.time.split('���')[0] + } + var dayZero = res.data.time.split('���')[1].split('���')[0] + if (dayZero.substr(0, 1) === '0') { + this.airData.day = dayZero.substr(1) + } else { + this.airData.day = dayZero + } + var arr = obj.date.split('-') + if (arr[2].substr(0, 1) === '0') { + arr[2] = arr[2].substr(1) + } + if (arr[1].substr(0, 1) === '0') { + arr[1] = arr[1].substr(1) + } + this.airData.currentTime = + arr[0] + '���' + arr[1] + '���' + arr[2] + '���' + this.airData.currentYear = arr[0] + var time1DayZero = '' + var time1MonthZero = '' + if ( + res.data.time1.split('���')[1].split('���')[0].substr(0, 1) === '0' + ) { + time1MonthZero = res.data.time1 + .split('���')[1] + .split('���')[0] + .substr(1) + } else { + time1MonthZero = res.data.time1.split('���')[1].split('���')[0] + } + + if ( + res.data.time1.split('���')[1].split('���')[0].substr(0, 1) === '0' + ) { + time1DayZero = res.data.time1 + .split('���')[1] + .split('���')[0] + .substr(1) + } else { + time1DayZero = res.data.time1.split('���')[1].split('���')[0] + } + this.airData.time1 = + res.data.time1.split('���')[0] + + '���' + + time1MonthZero + + '���' + + time1DayZero + + '���' + ExportBriefDataDocx( + '/airQuality1.docx', + this.airData, + `${obj.name}.docx` + ) + }) + .catch((err) => { + console.log(err) + }) }, // ��������������������� cityLast(list) { @@ -698,7 +832,9 @@ list.splice(i, 1) } }) - list.push(obj) + if (obj.place) { + list.push(obj) + } return list }, // ��������������������� @@ -710,7 +846,27 @@ list.splice(i, 1) } }) - list.unshift(obj) + if (obj.place) { + list.unshift(obj) + } + return list + }, + // ���������������������������������������/��������� + cityFirst2(list) { + var obj = {} + list.map((v, i) => { + if (v.place === '���������') { + obj = v + list.splice(i, 1) + } + if (v.place === '���������') { + obj = v + list.splice(i, 1) + } + }) + if (obj.place) { + list.unshift(obj) + } return list }, // ��������������������� @@ -719,33 +875,39 @@ url: '/excel/hnExcelExport', method: 'get', params: { - id: obj.id + id: obj.id, // id: 68 - } - }).then(res => { - // console.log(res) - this.hunNanAirData = res.data - // currentTime������ - var arr = res.data.time2.split('-') - var currentTime = arr[0] + '���' + arr[1] + '���' + arr[2] + '���' - var currentYear = arr[0] - this.hunNanAirData.currentTime = currentTime - this.hunNanAirData.currentYear = currentYear - // ������������������09���26���,yearDate������������ - var month = res.data.time.split('-')[0] - if (month.substr(0, 1) === '0') { - month = month.substr(1) - } - this.hunNanAirData.month = month - var day = res.data.time.split('-')[1] - if (day.substr(0, 1) === '0') { - day = day.substr(1) - } - this.hunNanAirData.day = day - ExportBriefDataDocx('/hunnan.docx', this.hunNanAirData, `���������${arr[1]}���${arr[2]}���������������������������.docx`) - }).catch(err => { - console.log(err) + }, }) + .then((res) => { + // console.log(res) + this.hunNanAirData = res.data + // currentTime������ + var arr = res.data.time2.split('-') + var currentTime = arr[0] + '���' + arr[1] + '���' + arr[2] + '���' + var currentYear = arr[0] + this.hunNanAirData.currentTime = currentTime + this.hunNanAirData.currentYear = currentYear + // ������������������09���26���,yearDate������������ + var month = res.data.time.split('-')[0] + if (month.substr(0, 1) === '0') { + month = month.substr(1) + } + this.hunNanAirData.month = month + var day = res.data.time.split('-')[1] + if (day.substr(0, 1) === '0') { + day = day.substr(1) + } + this.hunNanAirData.day = day + ExportBriefDataDocx( + '/hunnan.docx', + this.hunNanAirData, + `���������${arr[1]}���${arr[2]}���������������������������.docx` + ) + }) + .catch((err) => { + console.log(err) + }) }, // ���������excel������ hnExcel(obj) { @@ -753,184 +915,55 @@ url: '/excel/syExcelExport', method: 'get', params: { - id: obj.id - } - }).then(res => { - var code2 = res.data.code2.substr(0, 2) + '\n' + res.data.code2.substr(2) - var code4 = res.data.code4.substr(0, 2) + '\n' + res.data.code4.substr(2) - var table1Data = [['', '���������', '������', '������', '������'], ['', '', '', '', ''], ['���������', '300', res.data.code1, '', code2], ['', '', '', '', ''], ['PM2.5', '41', res.data.code3, '', code4], ['', '', '', '', '']] - var table3Data = [['', '���������', '���������', '������', '������'], ['', '���������', '���������', '������', '������'], ['���������', '80', '80', res.data.code5, ''], ['', '', '', '', ''], ['PM2.5', '23', '23', res.data.code6, ''], ['', '', '', '', '']] - var table2Data = [ - res.data.list.sy1, - res.data.list.sy2, - res.data.list.hnd1, - res.data.list.hnd2, - res.data.list.xxj1, - res.data.list.xxj2, - res.data.list.hnq1, - res.data.list.hnq2 - ] - var data = new Date() - var currentYearData = data.getFullYear() - var jd = res.data.season - ExportHunnanExcel(`������������������������${obj.time.split('-').join('')}`, table1Data, table3Data, table2Data, currentYearData, jd) - }).catch(err => { - console.log(err) + id: obj.id, + }, }) - }, - // ������������ - exportReport() { - // ������excel������ - // table1������������ - /* var table1Data = [['', '���������', '������', '������', '������'], ['', '', '', '', ''], ['���������', '300', '215', '', '������\n11���'], ['', '', '', '', ''], ['PM2.5', '41', '33', '33', '������\n20.7%'], ['', '', '', '', '']] - var table3Data = [['', '���������', '���������', '������', '������'], ['', '���������', '���������', '������', '������'], ['���������', '80', '80', '61', '61'], ['', '', '', '', ''], ['PM2.5', '23', '23', '18', '18'], ['', '', '', '', '']] - var table2Data = [ - ['������������', '21', '25', '29', '27', '24', '26', '28', '18', '5', '', '', '', '215', '������9���'], - ['PM2.5������������/������', '11', '30', '29', '27', '24', '26', '28', '18', '5', '', '', '', '215', '������17.9%'], - ['������������', '21', '25', '29', '27', '24', '26', '28', '18', '5', '', '', '', '215', '������9���'], - ['PM2.5������������/������', '22', '25', '23', '37', '34', '36', '38', '18', '5', '', '', '', '215', '������17.9%'], - ['������������', '21', '25', '29', '27', '24', '26', '28', '18', '5', '', '', '', '215', '������9���'], - ['PM2.5������������/������', '28', '69', '39', '27', '24', '26', '28', '18', '5', '', '', '', '215', '������17.9%'], - ['������������', '21', '25', '29', '27', '24', '26', '28', '18', '5', '', '', '', '215', '������9���'], - ['PM2.5������������/������', '32', '20', '29', '27', '24', '26', '28', '18', '5', '', '', '', '215', '������17.9%'] - ] - var data = new Date() - var currentYearData = data.getFullYear() - var jd = '���' - ExportHunnanExcel('������������������������', table1Data, table3Data, table2Data, currentYearData, jd)*/ - - // ������word������ - // ������ - /* var arr = this.newTimeNotZero(this.value3).split('-') - var currentTime = arr[0] + ' ���' + arr[1] + ' ���' + arr[2] + ' ���' - var currentYear = arr[0] - this.hunNanAirData.currentTime = currentTime - this.hunNanAirData.currentYear = currentYear - // ��������������������������� - var yearDate = '09���26���' - var list1 = { - sy: { - AQI: 127, - PM25: 38, - PM10: 75, - CO: 1.1, - O38H: 21, - SO2: 189, - NO2: 20, - ZH: 32, - PaiM: '-' - }, - hnd: { - AQI: 71, - PM25: 38, - PM10: 75, - CO: 1.1, - O38H: 21, - SO2: 189, - NO2: 20, - ZH: 32, - PaiM: '-' - }, - xxj: { - AQI: 72, - PM25: 38, - PM10: 75, - CO: 1.1, - O38H: 21, - SO2: 189, - NO2: 20, - ZH: 32, - PaiM: '-' - } - } - var hnd = { - hnd1: { - nd: '2022', - yl: '226', - excellent: '92', - good: '134', - slightPol: '36', - moderatePol: '6', - heavyPol: '1', - seriousPol: '0' - }, - hnd2: { - nd: '2021', - yl: '222', - excellent: '92', - good: '134', - slightPol: '36', - moderatePol: '6', - heavyPol: '1', - seriousPol: '0' - }, - hnd3: { - nd: '������������', - yl: '4', - excellent: '92', - good: '134', - slightPol: '36', - moderatePol: '6', - heavyPol: '1', - seriousPol: '0' - } - } - var xxj = { - xxj1: { - nd: '2022', - yl: '226', - excellent: '92', - good: '134', - slightPol: '36', - moderatePol: '6', - heavyPol: '1', - seriousPol: '0' - }, - xxj2: { - nd: '2021', - yl: '222', - excellent: '92', - good: '134', - slightPol: '36', - moderatePol: '6', - heavyPol: '1', - seriousPol: '0' - }, - xxj3: { - nd: '������������', - yl: '4', - excellent: '92', - good: '134', - slightPol: '36', - moderatePol: '6', - heavyPol: '1', - seriousPol: '0' - } - } - var datafor = { - so2: '23%', - no2: '25%', - co: '-23' - } - // var airQua = '���������' - var airQua = '���������' - this.hunNanAirData.list1 = list1 - this.hunNanAirData.hnd = hnd - this.hunNanAirData.xxj = xxj - this.hunNanAirData.airQua = airQua - // ������������������9���26��������������� - var month = yearDate.split('���')[0] - if (month.substr(0, 1) === '0') { - month = month.substr(1) - } - this.hunNanAirData.month = month - var day = yearDate.split('���')[1].split('���')[0] - if (day.substr(0, 1) === '0') { - day = day.substr(1) - } - this.hunNanAirData.day = day - this.hunNanAirData.datafor = datafor - ExportBriefDataDocx('/HunnanReport.docx', this.hunNanAirData, `���������${month}���${day}���������������������������.docx`)*/ + .then((res) => { + var code2 = + res.data.code2.substr(0, 2) + '\n' + res.data.code2.substr(2) + var code4 = + res.data.code4.substr(0, 2) + '\n' + res.data.code4.substr(2) + var table1Data = [ + ['', '���������', '������', '������', '������'], + ['', '', '', '', ''], + ['���������', '300', res.data.code1, '', code2], + ['', '', '', '', ''], + ['PM2.5', '41', res.data.code3, '', code4], + ['', '', '', '', ''], + ] + var table3Data = [ + ['', '���������', '���������', '������', '������'], + ['', '���������', '���������', '������', '������'], + ['���������', '69', '69', res.data.code5, ''], + ['', '', '', '', ''], + ['PM2.5', '40', '40', res.data.code6, ''], + ['', '', '', '', ''], + ] + var table2Data = [ + res.data.list.sy1, + res.data.list.sy2, + res.data.list.hnd1, + res.data.list.hnd2, + res.data.list.xxj1, + res.data.list.xxj2, + res.data.list.hnq1, + res.data.list.hnq2, + ] + var data = new Date() + var currentYearData = data.getFullYear() + var jd = res.data.season + ExportHunnanExcel( + `������������������������${obj.time.split('-').join('')}`, + table1Data, + table3Data, + table2Data, + currentYearData, + jd + ) + }) + .catch((err) => { + console.log(err) + }) }, // ������������ selectReport(val) { @@ -947,103 +980,107 @@ startTime: this.sensorTime2[0], endTime: this.sensorTime2[1], code: this.valueSelect, - pageCount: page - } - }).then(res => { - if (res.code === 0) { - var info = [] - if (this.isDisplay) { - this.totalNumber = res.data.total - info = res.data.item - } else { - info = res.data - } - info.map(v => { - if (this.valueSelect === 'gx') { - v.name = '���������������������������������' + v.time.split('-').join('') - } else { - v.name = '���������������' + v.time.split('-').join('') - } - }) - info.sort((a, b) => { return b.time.split('-').join('') - a.time.split('-').join('') }) - this.tableData = info - } - }).catch(err => { - console.log(err) + pageCount: page, + }, }) - } - } + .then((res) => { + if (res.code === 0) { + var info = [] + if (this.isDisplay) { + this.totalNumber = res.data.total + info = res.data.item + } else { + info = res.data + } + info.map((v) => { + if (this.valueSelect === 'gx') { + v.name = '���������������������������������' + v.time.split('-').join('') + } else { + v.name = '���������������' + v.time.split('-').join('') + } + }) + info.sort((a, b) => { + return b.time.split('-').join('') - a.time.split('-').join('') + }) + this.tableData = info + } + }) + .catch((err) => { + console.log(err) + }) + }, + }, } </script> <style scoped> -.analyseAir{ +.analyseAir { width: 100%; height: 100%; display: flex; padding-top: 22px; } - .exTop{ - width: 30%; - /*height: 95%;*/ - position: relative; - overflow: auto; - margin-bottom: 2%; - } - .cascader-demo{ - float: left; - padding: 0% 2%; - } - .upload-demo{ - margin-left: 2%; - /*float: left;*/ - margin-top: 4%; - height: 65px; - } - .upload-demo /deep/ .el-upload-list__item{ - font-size: 15px; - } -.upload-demo /deep/ .el-upload-list__item:first-child{ +.exTop { + width: 30%; + /*height: 95%;*/ + position: relative; + overflow: auto; + margin-bottom: 2%; +} +.cascader-demo { + float: left; + padding: 0% 2%; +} +.upload-demo { + margin-left: 2%; + /*float: left;*/ + margin-top: 4%; + height: 65px; +} +.upload-demo /deep/ .el-upload-list__item { + font-size: 15px; +} +.upload-demo /deep/ .el-upload-list__item:first-child { margin-top: 2px; } - .exDown { - width: 50%; - height: 95%; - margin-left: 2%; - font-size: 18px; - } - .exDown /deep/ .el-card{ - width: 100%; - height: 100%; - } - .divPadding{ - width: 80%; - margin: auto; - } - .textCenter{ - text-align: center; - } - .fontS14{ - font-size: 14px; - } - .upload-demo button{ - margin-right: 10%; - } - .upload-demo /deep/ .el-upload{ - margin-right: 10%; - } - .selectBtn{ - margin-left: 5%; - } - .el-card /deep/ .el-card__body{ - height: 815px; - } - .paginationDemo{ - position: absolute; - left: 0; - bottom: 3%; - } - .el-upload__tip{ - color: red; - } +.exDown { + width: 50%; + height: 95%; + margin-left: 2%; + font-size: 18px; +} +.exDown /deep/ .el-card { + width: 100%; + height: 100%; +} +.divPadding { + width: 80%; + margin: auto; +} +.textCenter { + text-align: center; +} +.fontS14 { + font-size: 14px; +} +.upload-demo button { + margin-right: 10%; +} +.upload-demo /deep/ .el-upload { + margin-right: 10%; +} +.selectBtn { + margin-left: 5%; +} +.el-card /deep/ .el-card__body { + height: 815px; +} +.paginationDemo { + position: absolute; + left: 0; + bottom: 3%; +} +.el-upload__tip { + color: red; +} </style> -- Gitblit v1.8.0