| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402 |
- <template>
- <view class="wrap">
- <uNavBar dark :fixed="true" backgroundColor="#3F9EFF" status-bar left-icon="left" left-text="返回"
- @clickLeft="toBack">
- <view style="width: 100%;display: flex;flex-direction: row;justify-content: center;align-items: center;">
- <text style="color: white;font-size: 1rem;">{{title}}</text>
- </view>
- </uNavBar>
- <view class="container">
- <uni-section title="查询" titleFontSize="0.8rem" type="line" style="padding-left: 10px;padding-right: 10px;">
- <uni-data-picker placeholder="请选择机构" popup-title="请选择所在地区" :localdata="projectTree"
- v-model="selectedTreeNode" @change="onchange" @nodeclick="onnodeclick" @popupopened="onpopupopened"
- @popupclosed="onpopupclosed">
- </uni-data-picker>
- </uni-section>
- <uni-section>
- <uni-search-bar placeholder="请录入测站编码或测站名称" @confirm="search" :focus="false" v-model="searchValue"
- @blur="blur" @focus="focus" @input="input" @cancel="cancel" @clear="clear">
- </uni-search-bar>
- </uni-section>
- <uni-section title="">
- <uni-table ref="table" :loading="loading" border stripe type="" emptyText="暂无更多数据">
- <uni-tr>
- <uni-th width="120" align="center">上报时间</uni-th>
- <uni-th align="center">测站名称</uni-th>
- <uni-th width="120" align="center">库上水位</uni-th>
- </uni-tr>
- <uni-tr v-for="(item, index) in tableData" :key="index">
- <uni-td>
- <view style="text-align: center;">{{ item.tm }}</view>
- </uni-td>
- <uni-td>
- <view v-if="item.rtuName" style="text-align: center;">
- {{ item.rtuName }}
- </view>
- <view v-else style="text-align: center;">
- {{ item.rtuCode }}
- </view>
- </uni-td>
- <uni-td align="center">
- <view style="text-align: center;color: coral;">{{ item.rz }}</view>
- </uni-td>
- </uni-tr>
- </uni-table>
- <view style="margin-top: 5px;background-color: azure;">
- <uniPagination show-icon :page-size="pageSize" :current="pageCurrent" :total="total"
- @change="change" />
- </view>
- </uni-section>
- </view>
- </view>
- </template>
- <script>
- import uniSearchBar from '@/uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.vue'
- import uNavBar from '@/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-nav-bar.vue'
- import uniDataPicker from '@/uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue'
- import uniGroup from '@/uni_modules/uni-group/uni-group.vue'
- import uniSection from '@/uni_modules/uni-section/uni-section.vue'
- import uniTable from '@/uni_modules/uni-table/components/uni-table/uni-table.vue'
- import uniPagination from '@/uni_modules/uni-pagination/components/uni-pagination/uni-pagination.vue'
- import uniBreadcrumb from '@/uni_modules/uni-breadcrumb/components/uni-breadcrumb/uni-breadcrumb.vue'
- import http from '@/http/api.js';
- import tableData from './data.js'
- export default {
- components: {
- uniSearchBar,
- uNavBar,
- uniGroup,
- uniSection,
- uniTable,
- uniPagination,
- uniBreadcrumb,
- },
- onLoad(option) {
- this.getProjectTree();
- },
- data() {
- return {
- selectedTreeNode: '',
- orgId: '',
- projectId: '',
- title: '水库水情实时数据',
- desc: '',
- searchValue: '',
- tableData: [],
- // 每页数据量
- pageSize: 10,
- // 当前页
- pageCurrent: 1,
- // 数据总量
- total: 0,
- loading: false,
- selectedIndexs: [],
- projectTree: [],
- }
- },
- computed: {
- getIcon() {
- return path => {
- return 'https://cdn.uviewui.com/uview/example/' + path + '.png';
- }
- },
- },
- onShow() {
- },
- methods: {
- toBack() {
- uni.navigateBack({
- delta: 1
- })
- },
- getProjectTree() {
- var that = this;
- http.request({
- url: '/galaxy-test/rtu/manage/tree',
- method: 'GET',
- }).then(res => {
- if (res.data != null) {
- that.projectTree = res.data;
- that.selectedTreeNode = that.projectTree[0].value;
- that.orgId = that.projectTree[0].orgId;
- that.projectId = that.projectTree[0].projectId;
- that.getData();
- }
- }).catch(err => {
- console.log(err)
- })
- },
- onnodeclick(e) {
- this.orgId = node.orgId;
- this.projectId = node.projectId;
- this.searchValue = '';
- this.pageCurrent = 1;
- this.getData();
- },
- onpopupopened(e) {
- },
- onpopupclosed(e) {
- },
- onchange(e) {
- console.log('onchange:', this.selectedTreeNode);
- },
- // 多选处理
- 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())
- },
- // 分页触发
- change(e) {
- this.$refs.table.clearSelection()
- this.selectedIndexs.length = 0
- this.pageCurrent = e.current;
- this.getData(e.current)
- },
- // 获取数据
- getData() {
- this.loading = true
- const current = this.pageCurrent;
- const size = this.pageSize;
- const isSubmit = '0';
- var formData = {};
- formData['rtuName'] = this.searchValue;
- formData['projectId'] = this.projectId;
- formData['orgId'] = this.orgId;
- var that = this;
- http.request({
- url: '/galaxy-test/rtu/data/rsvr/page',
- method: 'GET',
- params: {
- current,
- size,
- isSubmit
- },
- data: formData,
- }).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
- })
- },
- search(res) {
- this.getData();
- },
- input(res) {
- // console.log('----input:', res)
- },
- clear(res) {
- this.getData();
- },
- blur(res) {
- },
- focus(e) {
- },
- cancel(res) {
- this.getData();
- },
- onBackPress() {
- // #ifdef APP-PLUS
- plus.key.hideSoftKeybord();
- // #endif
- },
- }
- }
- </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;
- }
- .goods-carts {
- /* #ifndef APP-NVUE */
- display: flex;
- /* #endif */
- flex-direction: column;
- position: absolute;
- left: 0;
- right: 0;
- /* #ifdef H5 */
- left: var(--window-left);
- right: var(--window-right);
- /* #endif */
- top: 0;
- }
- .button {
- display: flex;
- align-items: center;
- height: 35px;
- margin-left: 10px;
- }
- .u-cell-icon {
- width: 36rpx;
- height: 36rpx;
- margin-right: 8rpx;
- }
- .slot-box {
- /* #ifndef APP-NVUE */
- display: flex;
- /* #endif */
- flex-direction: row;
- align-items: center;
- }
- .slot-image {
- /* #ifndef APP-NVUE */
- display: block;
- /* #endif */
- margin-right: 10px;
- width: 30px;
- height: 30px;
- }
- .slot-text {
- flex: 1;
- font-size: 14px;
- color: #4cd964;
- margin-right: 10px;
- }
- .content-box {
- flex: 1;
- /* #ifdef APP-NVUE */
- justify-content: center;
- /* #endif */
- height: 100%;
- line-height: 44px;
- padding: 0 15px;
- position: relative;
- background-color: #fff;
- border-bottom-color: #f5f5f5;
- border-bottom-width: 1px;
- border-bottom-style: solid;
- }
- .content-text {
- font-size: 15px;
- }
- .example-body {
- /* #ifndef APP-NVUE */
- display: flex;
- /* #endif */
- flex-direction: row;
- justify-content: center;
- padding: 10px 0;
- background-color: #fff;
- }
- .button {
- border-color: #e5e5e5;
- border-style: solid;
- border-width: 1px;
- padding: 4px 8px;
- border-radius: 4px;
- }
- .button-text {
- font-size: 15px;
- }
- .slot-button {
- /* #ifndef APP-NVUE */
- display: flex;
- height: 100%;
- /* #endif */
- flex: 1;
- flex-direction: row;
- justify-content: center;
- align-items: center;
- padding: 0 20px;
- background-color: #ff5a5f;
- }
- .slot-button-text {
- color: #ffffff;
- font-size: 14px;
- }
- .search-result {
- padding-top: 10px;
- padding-bottom: 20px;
- text-align: center;
- }
- .search-result-text {
- text-align: center;
- font-size: 14px;
- color: #666;
- }
- .example-body {
- /* #ifndef APP-NVUE */
- display: block;
- /* #endif */
- padding: 0px;
- }
- .uni-mt-10 {
- margin-top: 10px;
- }
- .uni-group {
- display: flex;
- align-items: center;
- }
- .data-pickerview {
- height: 400px;
- border: 1px #e5e5e5 solid;
- }
- .popper__arrow {
- top: -6px;
- left: 50%;
- margin-right: 3px;
- border-top-width: 0;
- border-bottom-color: #EBEEF5;
- }
- .popper__arrow {
- top: -6px;
- left: 50%;
- margin-right: 3px;
- border-top-width: 0;
- border-bottom-color: #EBEEF5;
- }
- </style>
|