| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349 |
- <!--
- * @Title:
- * @Description: 雨情数据
- * @Author: swp
- * @Date: 2022-08-24 10:49:21
- * @LastEditors:
- * @LastEditTime: 2022-08-24 10:49:21
- -->
- <template>
- <view class="wrap">
- <view class="container">
- <uni-section title="查询" titleFontSize="0.8rem" type="line" style="padding-left: 0px;padding-right: 0px;">
- <view class="search-block">
- <view class="adcd-adnm">
- <uni-data-picker placeholder="请选择地区" popup-title="请选择所在地区" :localdata="regionTree"
- v-model="selectedTreeNode" @change="onTreeChange" @nodeclick="onTreeNodeClick"
- @popupopened="onTreePopupOpened" @popupclosed="onTreePopupClosed" :clear-icon="false">
- </uni-data-picker>
- </view>
- <view class="rtu-code">
- <uni-easyinput :styles="inputStyles" @input="searchRtuCodeValClear" prefixIcon="search"
- v-model="searchRtuCodeVal" placeholder="请输入测站编码">
- </uni-easyinput>
- </view>
- <view class="rtu-name">
- <uni-easyinput :styles="inputStyles" @input="searchRtuNameValClear" prefixIcon="search"
- v-model="searchRtuNameVal" placeholder="请输入测站名称">
- </uni-easyinput>
- </view>
- <view class="submit-btn">
- <button type="default" @click="search">查 询</button>
- </view>
- </view>
- </uni-section>
- <uni-group>
- <!-- <uni-card title="统计时间" :is-shadow="false" style="margin-left: 0px;margin-right: 0px;"> -->
- <radio-group @change="onRainCountTypeRadioChange" class="view-flex-rs">
- <label style="margin-right: 5px;margin-bottom: 5px;;width:100px;" class="view-flex-inline"
- v-for="(item, index) in rainCountType.items" :key="item.id">
- <view>
- <radio :value="item.id" :checked="index === rainCountType.value" />
- </view>
- <view style="font-size: 0.7rem;">{{item.dictValue}}</view>
- </label>
- </radio-group>
- <!-- </uni-card> -->
- </uni-group>
- <uni-table ref="table" :loading="loading" border stripe type="" emptyText="暂无更多数据">
- <uni-tr>
- <uni-th align="center" width="120">上报时间</uni-th>
- <uni-th align="center" width="120">测站名称</uni-th>
- <uni-th align="center" width="70">时段长</uni-th>
- <uni-th align="center">降水量</uni-th>
- </uni-tr>
- <uni-tr v-for="(item, index) in tableData" :key="index">
- <uni-td align="center">
- <view style="text-align: center;">{{ item.tm }}</view>
- </uni-td align="center">
- <uni-td>
- <view style="text-align: center;">
- {{ item.rtuName }}/{{ item.rtuCode }}
- </view>
- </uni-td>
- <uni-td align="center">
- <!-- <view v-if="item.intv === 1.0" style="text-align: center;color: coral;">1小时</view>
- <view v-else style="text-align: center;color: coral;">5分钟</view> -->
- <view style="text-align: center;color: coral;">{{item.intvLable}}</view>
- </uni-td>
- <uni-td align="center">
- <view style="text-align: center;color: coral;">{{ item.drp }}</view>
- </uni-td>
- </uni-tr>
- </uni-table>
- <view class="pagination-block">
- <uni-pagination :page-size="pageSize" :current="pageCurrent" :total="total" @change="pageChange"
- prevText="前一页" nextText="后一页" />
- </view>
- </view>
- </view>
- </template>
- <script>
- import http from '@/http/api.js';
- export default {
- components: {},
- onLoad(option) {
- },
- created() {
- this.getRegionTree();
- },
- data() {
- return {
- title: '雨水情实时数据',
- regionTree: [],
- regionCode: '',
- selectedTreeNode: '',
- searchRtuNameVal: '',
- searchRtuCodeVal: '',
- query: {},
- inputStyles: {
- color: '#808080',
- borderColor: '#d3d3d3'
- },
- // 每页数据量
- pageSize: 10,
- // 当前页
- pageCurrent: 1,
- // 数据总量
- total: 0,
- loading: false,
- tableData: [],
- rainCountType: {
- items: [{
- 'id': '0',
- 'dictValue': '默认'
- }, {
- 'id': '1',
- 'dictValue': '近1小时'
- }, {
- 'id': '2',
- 'dictValue': '近3小时'
- }, {
- 'id': '3',
- 'dictValue': '近6小时'
- }, {
- 'id': '4',
- 'dictValue': '近12小时'
- }, {
- 'id': '5',
- 'dictValue': '近24小时'
- }],
- value: 0,
- }
- }
- },
- computed: {},
- onShow() {},
- methods: {
- toBack() {
- uni.navigateBack({
- delta: 1
- })
- },
- onBackPress() {
- // #ifdef APP-PLUS
- plus.key.hideSoftKeybord();
- // #endif
- },
- // 分页触发
- pageChange(e) {
- this.$refs.table.clearSelection()
- //this.selectedIndexs.length = 0
- this.pageCurrent = e.current;
- this.getPage()
- },
- onRainCountTypeRadioChange: function(evt) {
- for (let i = 0; i < this.rainCountType.items.length; i++) {
- if (this.rainCountType.items[i].id === evt.detail.value) {
- this.rainCountType.value = i;
- this.pageCurrent = 1;
- this.getPage();
- break;
- }
- }
- },
- onTreeNodeClick(node) {
- console.log(JSON.stringify(node))
- },
- onTreePopupOpened(e) {
- console.log(JSON.stringify(e))
- },
- onTreePopupClosed(e) {
- console.log(JSON.stringify(e))
- },
- onTreeChange(e) {
- console.log(JSON.stringify(e))
- let nodes = e.detail.value;
- if (nodes.length > 0) {
- let node = nodes[nodes.length - 1];
- this.regionCode = node.value;
- this.query = {};
- this.query['adCode'] = this.regionCode;
- this.searchRtuNameVal = '';
- this.searchRtuCodeVal = '';
- this.pageCurrent = 1;
- this.getPage();
- } else {
- this.regionCode = '';
- this.query = {};
- this.searchRtuNameVal = '';
- this.searchRtuCodeVal = '';
- this.pageCurrent = 1;
- this.getPage();
- }
- },
- //录入查询
- search() {
- this.pageCurrent = 1;
- // console.log(JSON.stringify(res))
- let params = {};
- if (this.searchRtuCodeVal.length > 0) {
- params['rtuCode'] = this.searchRtuCodeVal;
- }
- if (this.searchRtuNameVal.length > 0) {
- params['rtuName'] = this.searchRtuNameVal;
- }
- this.getPage(params);
- },
- searchRtuNameValClear(e) {
- if (e == null || e.length == 0) {
- this.searchRtuNameVal = '';
- if (this.searchRtuNameVal.length == 0) {
- let params = {};
- if (this.searchRtuCodeVal.length > 0) {
- params['rtuCode'] = this.searchRtuCodeVal;
- }
- this.getPage(params);
- }
- }
- },
- searchRtuCodeValClear(e) {
- if (e == null || e.length == 0) {
- this.searchRtuCodeVal = '';
- if (this.searchRtuCodeVal.length == 0) {
- let params = {};
- if (this.searchRtuNameVal.length > 0) {
- params['rtuName'] = this.searchRtuNameVal;
- }
- this.getPage(params);
- }
- }
- },
- // 多选处理
- selectedItems() {
- return this.selectedIndexs.map(i => this.tableData[i])
- },
- // 多选
- selectionChange(e) {
- console.log(e.detail.index)
- this.selectedIndexs = e.detail.index
- },
- //批量删除
- delTable() {
- //console.log(this.selectedItems())
- },
- getRegionTree() {
- var that = this;
- http.request({
- url: '/galaxy-business/baseinfo/region/tree',
- method: 'GET',
- }).then(res => {
- if (res.data != null) {
- that.regionTree = res.data;
- that.selectedTreeNode = that.regionTree[0].value;
- that.regionCode = that.regionTree[0].value;
- that.query = {};
- that.query['adCode'] = that.regionCode;
- //that.orgId = that.projectTree[0].orgId;
- //that.projectId = that.projectTree[0].projectId;
- that.getPage();
- //that.getCountInfo(that.regionCode);
- }
- }).catch(err => {
- console.log(err)
- })
- },
- // 获取数据
- getPage(params = {}) {
- this.loading = true;
- const current = this.pageCurrent;
- const size = this.pageSize;
- const isSubmit = '0';
- if (this.rainCountType.value == 1) {
- params['rainCountType'] = 1;
- } else if (this.rainCountType.value == 2) {
- params['rainCountType'] = 3;
- } else if (this.rainCountType.value == 3) {
- params['rainCountType'] = 6;
- } else if (this.rainCountType.value == 4) {
- params['rainCountType'] = 12;
- } else if (this.rainCountType.value == 5) {
- params['rainCountType'] = 24;
- } else {
- params['rainCountType'] = 0;
- }
- let postData = Object.assign(params, this.query);
- console.log(JSON.stringify(postData))
- var that = this;
- http.request({
- url: '/galaxy-business/rtu/data/rain/page',
- method: 'GET',
- params: {
- current,
- size,
- isSubmit
- },
- data: postData,
- }).then(res => {
- if (res.data.records != null) {
- that.tableData = res.data.records;
- that.total = res.data.total;
- }
- this.loading = false
- }).catch(err => {
- console.log(err)
- this.loading = false
- })
- },
- }
- }
- </script>
- <style>
- /* page {
- background-color: rgb(240, 242, 244);
- } */
- </style>
- <style lang="scss" scoped>
- .wrap {
- padding: 0 0 100rpx;
- }
- .container {
- background-color: #f7f7f7;
- min-height: 100vh;
- overflow: hidden;
- }
- .view-flex-rs {
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- align-items: center;
- flex-wrap: wrap;
- }
- .view-flex-inline {
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- align-items: center;
- }
- </style>
|