| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { |
| | | getFeTempHumDate, |
| | | addFeTempHumDate, |
| | | getFeTempHumRecordPage, |
| | | addFeTempHumRecord, |
| | | selectUserCondition, |
| | | deleteFeTempHumRecord, |
| | | deleteFeTempHumDate, |
| | | exportTemperatureAndHumidityRecords, |
| | | affirmFeTempHumDate |
| | | } from '@/api/cnas/resourceDemand/facilitiesEnvironment/facilitiesAndEnvironment' |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | |
| | | dateId: this.approvalRow.dateId, |
| | | subjoin: this.subjoin, |
| | | } |
| | | this.$axios.post(this.$api.facilitiesAndEnvironment.affirmFeTempHumDate, params, { |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | | }, |
| | | noQs: true |
| | | }).then(res => { |
| | | affirmFeTempHumDate(params).then(res => { |
| | | this.approvalLoading = false |
| | | if (res.code === 200) { |
| | | this.$message.success('确认成功!') |
| | |
| | | }) |
| | | }, |
| | | openDialog() { |
| | | this.$axios.get(this.$api.deviceScope.selectUserList).then(res => { |
| | | selectUserCondition().then(res => { |
| | | if (res.code == 200) { |
| | | this.responsibleOptions = res.data |
| | | } |
| | |
| | | this.$refs.form.validate((valid) => { |
| | | if (valid) { |
| | | this.submitLoading = true |
| | | this.$axios.post(this.$api.facilitiesAndEnvironment.addFeTempHumDate, this.form, { |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | | } |
| | | }).then(res => { |
| | | addFeTempHumDate(this.form).then(res => { |
| | | if (res.code === 200) { |
| | | this.$message.success('新增成功!') |
| | | this.submitLoading = false |
| | |
| | | this.submitLoading = true |
| | | if (valid) { |
| | | this.form1.dateId = this.saveRow.dateId |
| | | this.$axios.post(this.$api.facilitiesAndEnvironment.addFeTempHumRecord, this.form1, { |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | | } |
| | | }).then(res => { |
| | | addFeTempHumRecord(this.form1).then(res => { |
| | | if (res.code === 200) { |
| | | this.$message.success('新增成功!') |
| | | this.submitLoading = false |
| | |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | this.$axios.delete(this.$api.facilitiesAndEnvironment.deleteFeTempHumDate + '?dateId=' + row.dateId).then(res => { |
| | | deleteFeTempHumDate({dateId:row.dateId}).then(res => { |
| | | this.$message.success('删除成功!') |
| | | this.initData() |
| | | }) |
| | |
| | | }, |
| | | // 导出 |
| | | downLoadPost(row) { |
| | | this.$axios.get(this.$api.facilitiesAndEnvironment.exportTemperatureAndHumidityRecords + '?dateId=' + row.dateId,{responseType: "blob"}).then(res => { |
| | | exportTemperatureAndHumidityRecords({dateId:row.dateId}).then(res => { |
| | | this.outLoading = false |
| | | const blob = new Blob([res],{ type: 'application/msword' }); |
| | | //将Blob 对象转换成字符串 |
| | | let reader = new FileReader(); |
| | | reader.readAsText(blob, 'utf-8'); |
| | | reader.onload = () => { |
| | | try { |
| | | let result = JSON.parse(reader.result); |
| | | if (result.message) { |
| | | this.$message.error(result.message); |
| | | } else { |
| | | const url = URL.createObjectURL(blob); |
| | | const link = document.createElement('a'); |
| | | link.href = url; |
| | | link.download = '温湿度记录' + '.docx'; |
| | | link.click(); |
| | | this.$message.success('导出成功') |
| | | } |
| | | } catch (err) { |
| | | console.log(err); |
| | | const url = URL.createObjectURL(blob); |
| | | const link = document.createElement('a'); |
| | | link.href = url; |
| | | link.download = '温湿度记录' + '.docx'; |
| | | link.click(); |
| | | this.$message.success('导出成功') |
| | | } |
| | | } |
| | | this.$download.saveAs(blob, '温湿度记录.docx') |
| | | this.$message.success('导出成功') |
| | | }) |
| | | }, |
| | | deleteRowFun1(row) { |
| | |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | this.$axios.delete(this.$api.facilitiesAndEnvironment.deleteFeTempHumRecord + '?tempHumId=' + row.tempHumId).then(res => { |
| | | deleteFeTempHumRecord({tempHumId:row.tempHumId}).then(res => { |
| | | this.$message.success('删除成功!') |
| | | this.initData1(this.saveRow.dateId) |
| | | }) |
| | | }) |
| | | }, |
| | | initData() { |
| | | this.$axios.get(this.$api.facilitiesAndEnvironment.getFeTempHumDate + '?size=' + this.search.size + '¤t=' + this.search.current + '&testAreaName=' + this.search.testAreaName).then(res => { |
| | | if (res.code === 201) return; |
| | | this.tableData = res.data.records; |
| | | this.search.total = res.data.total; |
| | | if (res.data.records.length === 0) { |
| | | this.tableData1 = [] |
| | | this.saveRow.monthDate = '' |
| | | getFeTempHumDate({ |
| | | ...this.search, |
| | | ...this.search}).then(res => { |
| | | if (res.code === 200){ |
| | | this.tableData = res.data.records; |
| | | this.search.total = res.data.total; |
| | | if (res.data.records.length === 0) { |
| | | this.tableData1 = [] |
| | | this.saveRow.monthDate = '' |
| | | } |
| | | } |
| | | }); |
| | | |
| | | }) |
| | | }, |
| | | initData1(dateId) { |
| | | this.$axios.get(this.$api.facilitiesAndEnvironment.getFeTempHumRecordPage + '?size=' + this.search1.size + '¤t=' + this.search1.current + '&dateId=' + dateId).then(res => { |
| | | if (res.code === 201) return; |
| | | this.tableData1 = res.data.records; |
| | | this.search1.total = res.data.total; |
| | | let form = {dateId: dateId} |
| | | getFeTempHumRecordPage({ |
| | | ...this.search1, |
| | | ...form |
| | | }).then(res => { |
| | | if (res.code === 200){ |
| | | this.tableData1 = res.data.records; |
| | | this.search1.total = res.data.total; |
| | | } |
| | | }); |
| | | }, |
| | | handleSizeChange(val) { |