|
@@ -2,27 +2,9 @@
|
|
|
<div id="planDayilyReport" class="planDayilyReport">
|
|
|
<div class="filteroption">
|
|
|
<div>
|
|
|
- <!-- <span class="spanjg">类型:</span>
|
|
|
- <el-select
|
|
|
- v-model="categoryName"
|
|
|
- clearable
|
|
|
- filterable
|
|
|
- style="display: inline-block; margin-left: 5px; width: 140px;"
|
|
|
- size="small"
|
|
|
- placeholder="请选择类型"
|
|
|
- @clear="selectClear"
|
|
|
- @change="selectChange"
|
|
|
- >
|
|
|
- <el-option key="1" label="水厂" value="1" />
|
|
|
- <el-option key="2" label="管网" value="2" />
|
|
|
- </el-select>
|
|
|
- -->
|
|
|
<span class="spanjg">设备类型:</span>
|
|
|
- <!-- <el-select ref="site" v-model="deviceType" style="display: inline-block; margin-right: 5px" size="small" placeholder="请选择" @change="bindTsNameChange">
|
|
|
- <el-option v-for="item in isSeletcSite" :key="item.id" :label="item.name" :value="item.id" />
|
|
|
- </el-select> -->
|
|
|
<el-select
|
|
|
- v-model="deviceType" @change="bindTsNameChange"
|
|
|
+ v-model="querySearch.deviceType" @change="bindTsNameChange"
|
|
|
size="small"
|
|
|
clearable
|
|
|
placeholder="请选择设备类型"
|
|
@@ -31,7 +13,7 @@
|
|
|
<el-option v-for="item in isSeletcSite" :key="item.ccode" :label="item.cname" :value="item.ccode" />
|
|
|
</el-select>
|
|
|
<span class="spanjg">指标类型:</span>
|
|
|
- <el-select v-model="type" style="display: inline-block; margin-right: 5px" size="small" placeholder="请选择" @change="bindTstTypeChange">
|
|
|
+ <el-select v-model="querySearch.type" style="display: inline-block; margin-right: 5px" size="small" placeholder="请选择" @change="bindTstTypeChange">
|
|
|
<el-option v-for="item in types" :key="item.type" :label="item.typeName" :value="item.type" />
|
|
|
</el-select>
|
|
|
<!-- <span class="spanjg">指标名称:</span>
|
|
@@ -39,11 +21,18 @@
|
|
|
<el-option v-for="item in indexNames" :key="item.id" :label="item.displayName" :value="item.id" />
|
|
|
</el-select> -->
|
|
|
<span class="spanjg" style="margin-left:8px;">日期:</span>
|
|
|
- <el-date-picker v-model="monthTime" size="small" type="month" placeholder="请选择日期" value-format="yyyy-MM-dd" style="width:140px" />
|
|
|
- <el-button size="small" type="primary" @click="getDailyReportData">查询</el-button>
|
|
|
+ <el-date-picker v-model="querySearch.startDate" size="small" :type="pickerdate.type" placeholder="请选择开始日期" :picker-options="startOptions" :value-format="pickerdate.format" style="width:140px" />
|
|
|
+ <span> ~</span>
|
|
|
+ <el-date-picker v-model="querySearch.endDate" size="small" :type="pickerdate.type" placeholder="请选择结束日期" :picker-options="endOptions" :value-format="pickerdate.format" style="width:140px" />
|
|
|
+ <el-button size="small" type="primary" @click="getDailyReportData()">查询</el-button>
|
|
|
</div>
|
|
|
<div>
|
|
|
- <export-btn table-id="planDayilyReportTable" />
|
|
|
+ <!-- <export-btn table-id="planDayilyReportTable" /> -->
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ @click="getDailyReportData(1)"
|
|
|
+ >导出</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="statistics" style="height:calc(100% - 40px)">
|
|
@@ -70,31 +59,36 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import TableItem from '@/components/TableAuto'
|
|
|
-import ExportBtn from '../../components/ExportBtn.vue'
|
|
|
+
|
|
|
import { reportFormCensus, queryDevice, queryIndexConfiguration } from '@/api/scadaApi'
|
|
|
import { getSysCommonCode } from '@/api/dataCenter'
|
|
|
|
|
|
+import comMixins from '@/views/mixins/comMixins'
|
|
|
+
|
|
|
export default {
|
|
|
name: 'ScadaDailyReport',
|
|
|
components: {
|
|
|
- TableItem, ExportBtn
|
|
|
+ TableItem
|
|
|
},
|
|
|
+ mixins: [comMixins],
|
|
|
props: ['data'],
|
|
|
data() {
|
|
|
return {
|
|
|
- startTime: '',
|
|
|
- endTime: '',
|
|
|
+ pickerdate: {
|
|
|
+ type: 'date',
|
|
|
+ format: 'yyyy-MM-dd'
|
|
|
+ },
|
|
|
startOptions: {
|
|
|
disabledDate: time => {
|
|
|
- if (this.endTime) {
|
|
|
- return time.getTime() >= new Date(this.endTime)
|
|
|
+ if (this.querySearch.endDate) {
|
|
|
+ return time.getTime() >= new Date(this.querySearch.endDate)
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
endOptions: {
|
|
|
disabledDate: time => {
|
|
|
- if (this.startTime) {
|
|
|
- return new Date(this.startTime) - 1000 * 60 * 60 * 24 > time.getTime()
|
|
|
+ if (this.querySearch.startDate) {
|
|
|
+ return new Date(this.querySearch.startDate) - 1000 * 60 * 60 * 24 > time.getTime()
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -115,7 +109,7 @@ export default {
|
|
|
},
|
|
|
{
|
|
|
label: '采集值',
|
|
|
- prop: 'ave',
|
|
|
+ prop: 'max',
|
|
|
align: 'center',
|
|
|
sortable: true
|
|
|
},
|
|
@@ -133,18 +127,28 @@ export default {
|
|
|
}
|
|
|
],
|
|
|
categoryName: '1',
|
|
|
- deviceType: '',
|
|
|
+
|
|
|
isSeletcSite: [],
|
|
|
- type: '',
|
|
|
+
|
|
|
types: [],
|
|
|
indexName: [],
|
|
|
indexNames: [],
|
|
|
monthTime: '',
|
|
|
- pageInfo: { current: 1, size: 20, tableTotal: 0 } // 分页数据
|
|
|
+ pageInfo: { current: 1, size: 20, tableTotal: 0 }, // 分页数据
|
|
|
+
|
|
|
+ querySearch: { // 查询参数
|
|
|
+ startDate: '',
|
|
|
+ endDate: '',
|
|
|
+ deviceType: '',
|
|
|
+ type: '1',
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
},
|
|
|
+ created() {
|
|
|
+ this.initDate()
|
|
|
+ },
|
|
|
mounted: function() {
|
|
|
const data = this.getTimeSplit()
|
|
|
this.startTime = data.now
|
|
@@ -154,15 +158,33 @@ export default {
|
|
|
|
|
|
},
|
|
|
methods: {
|
|
|
+ /**
|
|
|
+ * @description 初始化时间
|
|
|
+ */
|
|
|
+ initDate(){
|
|
|
+ this.querySearch.startDate = this.getDiffDay(1) //this.getCurrentFirstDay()
|
|
|
+ this.querySearch.endDate = this.getDiffDay(1)
|
|
|
+ },
|
|
|
+
|
|
|
// 获取巡查日报信息
|
|
|
- getDailyReportData() {
|
|
|
+ getDailyReportData(isexport) {
|
|
|
+ if (this.strIsNull(this.querySearch.startDate) ||
|
|
|
+ this.strIsNull(this.querySearch.endDate))
|
|
|
+ {
|
|
|
+ this.$message.error('请选择开始日期和结束日期')
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
const data = {
|
|
|
type: this.categoryName,
|
|
|
- deviceType: this.deviceType,
|
|
|
- censusDate: this.monthTime,
|
|
|
+ deviceType: this.querySearch.deviceType,
|
|
|
+ startTime: this.querySearch.startDate+" 00:00:00",
|
|
|
+ endTime: this.querySearch.endDate+" 23:59:59",
|
|
|
censusDateType: '3', // 按天查询
|
|
|
- indexId: this.indexName.toString()
|
|
|
+ indexTypes: this.querySearch.type //指标类型
|
|
|
+ //indexId: this.indexName.toString()
|
|
|
}
|
|
|
+
|
|
|
if(data.deviceType == ""){
|
|
|
this.$message({
|
|
|
type: "error",
|
|
@@ -170,15 +192,28 @@ export default {
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
- Object.assign(data, this.pageInfo)
|
|
|
- reportFormCensus(data).then(res => {
|
|
|
- if (res.code == 1) {
|
|
|
- this.dataList = res.result.records.reverse()
|
|
|
- this.pageInfo.tableTotal = res.result.total
|
|
|
- }
|
|
|
- console.log(res)
|
|
|
- })
|
|
|
+
|
|
|
+ if(!this.strIsNull(isexport)){
|
|
|
+ Object.assign(data, {export:isexport+""})
|
|
|
+ reportFormCensus(data,data.export).then((res) => {
|
|
|
+ console.log(res)
|
|
|
+ const blob = URL.createObjectURL(new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }))
|
|
|
+ const a = document.createElement('a')
|
|
|
+ a.href = blob
|
|
|
+ a.download = '监测日报.xlsx'
|
|
|
+ a.click()
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ Object.assign(data, this.pageInfo)
|
|
|
+ reportFormCensus(data).then(res => {
|
|
|
+ if (res.code == 1) {
|
|
|
+ this.dataList = res.result.records.reverse()
|
|
|
+ this.pageInfo.tableTotal = res.result.total
|
|
|
+ }
|
|
|
+ console.log(res)
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
// 获取当前时间
|
|
|
getTimeSplit() {
|
|
@@ -210,7 +245,7 @@ export default {
|
|
|
this.types = []
|
|
|
this.indexNames = []
|
|
|
this.targetIndex = {}
|
|
|
- this.deviceType = ''
|
|
|
+ this.querySearch.deviceType = ''
|
|
|
this.type = ''
|
|
|
this.indexName = []
|
|
|
this.dataList = []
|
|
@@ -224,7 +259,7 @@ export default {
|
|
|
getSysCommonCode({ pCid: '53400' }).then(res => {
|
|
|
this.isSeletcSite = res.result[0].codeList
|
|
|
if(this.isSeletcSite.length>0){
|
|
|
- this.deviceType = this.isSeletcSite[0].ccode
|
|
|
+ this.querySearch.deviceType = this.isSeletcSite[0].ccode
|
|
|
this.bindTsNameChange()
|
|
|
this.getDailyReportData()
|
|
|
}
|
|
@@ -232,7 +267,7 @@ export default {
|
|
|
},
|
|
|
|
|
|
queryIndexType() {
|
|
|
- // deviceId: this.deviceType,
|
|
|
+ // deviceId: this.querySearch.deviceType,
|
|
|
queryIndexConfiguration({ size: 10000 }).then(res => {
|
|
|
const arr = this.process(res.result.records)
|
|
|
this.types = arr
|
|
@@ -241,7 +276,7 @@ export default {
|
|
|
},
|
|
|
queryIndexConfiguration() {
|
|
|
const that = this
|
|
|
- // deviceId: this.deviceType,
|
|
|
+ // deviceId: this.querySearch.deviceType,
|
|
|
that.indexName = []
|
|
|
queryIndexConfiguration({ type: this.type, size: 10000 }).then(res => {
|
|
|
that.indexNames = res.result.records
|