123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271 |
- <template>
- <view class="">
-
- <!-- 筛选框start -->
- <view style="height:98rpx"></view>
- <view class="ding">
- <!-- <calendar></calendar> -->
- <view class="example-body">
- <uni-datetime-picker v-model="datetimerange" type="daterange" start-placeholder="请选择开始时间"
- end-placeholder="请选择结束时间" start="2000-3-20 12:00:00" end="2025-10-20 20:00:00" rangeSeparator="至" />
- </view>
- </view>
- <!-- 筛选框end -->
- <view class="site-items" style="margin-top:0;height: calc(100vh - 286rpx)">
- <view class="cu-list menu-avatar" >
- <view class="cu-item" :class="modalName=='move-box-'+ index?'move-cur':''"
- v-for="(item,index) in funcReport" :key="index"
- @touchstart="ListTouchStart"
- @touchmove="ListTouchMove" @touchend="ListTouchEnd" :data-target="'move-box-' + index"
- >
- <view class="cu-avatar round lg">
- <image class="image-bg" src="@/static/images/setting/funcList.png"/>
- </view>
- <view class="content">
- <view class="pro-title">
- <view class="cut">{{item.report_name}}</view>
- </view>
- <view class="pro-des ">
- <view class="text-cut">
- {{item.remarks }}
- </view>
- </view>
- <view class="pro-date ">{{item.add_time}}</view>
- </view>
- <view class="nav-right num">
- <view class="text-grey">
- <text class="icon iconfont margin-right-sm margin-left-lg"></text>
- </view>
- </view>
- <view class="move">
- <view class="bg-grey" @click.stop="editItem(item)">编辑</view>
- <view class="bg-red" @click.stop="deleteItem(item)">删除</view>
- </view>
- </view>
- </view>
- <view v-if="!funcReport.length&&authListRes==1" class="text-center margin-top"> 暂无数据</view>
- <view v-show="isLoadMore&&this.pages>1" style="padding-bottom:60px">
- <uni-load-more :status="loadStatus"></uni-load-more>
- </view>
-
- <view style="padding-bottom:60px"></view>
-
-
- </view>
-
-
-
- <!-- 新增按钮start -->
- <view style="width: 100%;
- position: fixed;
- bottom: 0px;
- right: 0px;
- height: 64px;
- background: #fff;">
- <view class="plus">
- <image src="@/static/images/setting/plus.png" style="width:100rpx;height:100rpx" @tap="goAddPage()"></image>
- </view>
- </view>
-
- <!-- 新增按钮end -->
- </view>
- </template>
- <script>
- import json from '../../../data/json.js';
- export default {
- data() {
- return {
- funcReport: [],
- modalName: null,
- getData:[],
- dwtype:0,
- datetimerange: ['', ''],
-
- listTouchStart: 0,
- listTouchDirection: null,
-
-
- flag:false,
-
- authListRes:0,
-
-
- pages: 1,
- size: 12,
- loadStatus: 'loading', //加载样式:more-加载前样式,loading-加载中样式,nomore-没有数据样式
- isLoadMore: false, //是否加载中
- deleteStatus:false,
- };
- },
-
- onReachBottom() { //上拉触底函数
- if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
- this.isLoadMore = true
- this.pages += 1;
- this.loadData()
- }
- },
- onLoad: function(option) {
- this.dwtype=option.dwtype
- this.loadData()
- },
- onNavigationBarButtonTap(e) {
- console.log(e)
- uni.navigateTo({
- url: './export/export?dwtype='+this.dwtype,
- });
- },
- watch: {
-
-
- datetimerange:function(){
- this.funcReport=[];
- this.pages = 1;
- this.authListRes=[]
- this.loadData()
- },
-
-
- },
- methods: {
-
- loadData(){
-
- this.getDeviceList({
- 'company_code':uni.getStorageSync('selectedCode'),
- 'start_time':this.datetimerange[0],
- 'end_time':this.datetimerange[1],
- 'pages': this.pages,
- 'size': this.size
- })
-
- },
-
-
- // 设备类型数据请求
- async getDeviceList(params = {}) {
- const res = await this.$myRequest({
- url: 'AlarmReport/index',
- data:params,
- showLoading: true
- })
-
- if(this.deleteStatus){
- this.funcReport=[];
- this.deleteStatus=false;
- }
- this.authListRes = 1;
-
-
- if (res.data.totalcount) {
- this.funcReport = this.funcReport.concat(res.data.data)
- if (res.data.data.length < this.size) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
-
- this.isLoadMore = true
- this.loadStatus = 'nomore'
- } else {
- this.isLoadMore = false
- }
- } else {
- this.isLoadMore = true
- this.loadStatus = 'nomore'
- }
-
-
- },
-
- //编辑
- editItem(item) {
- uni.redirectTo({
- url: '/pages/setting/funReport/funcAdd/funcAdd?id=' + item.id + '',
- });
- },
-
- //删除
- deleteItem(item) {
- let deleteT=0;
- this.deleteStatus=true
- uni.showModal({
- title: '确认删除吗?',
- content: '',
- success: function (result) {
- if (result.confirm) {
- this.deleteAlarm({
- "id": item.id
- });
- } else if (result.cancel) {
- console.log('用户点击取消');
- }
- }.bind(this)
- });
- },
-
-
- // 删除请求接口
- async deleteAlarm(ming = {}) {
- let res = await this.$myRequest({
- url: 'AlarmReport/del ',
- data: ming
- })
- if (!res.data.flag) {
- alert('删除失败');
- return;
- }
- this.getDeviceList({'company_code':uni.getStorageSync('selectedCode')})
-
- return res;
- },
-
- // 新增
- goAddPage(type) {
- uni.redirectTo({
- url: '/pages/setting/funReport/funcAdd/funcAdd',
- success: res => {},
- fail: () => {},
- complete: () => {}
- });
- },
-
-
-
- // ListTouch触摸开始
- ListTouchStart(e) {
- this.listTouchStart = e.touches[0].pageX
- },
-
- // ListTouch计算方向
- ListTouchMove(e) {
- this.listTouchDirection = e.touches[0].pageX - this.listTouchStart < -80 ? 'left' : 'right'
- },
-
- // ListTouch计算滚动
- ListTouchEnd(e) {
- if (this.listTouchDirection == 'left') {
- this.modalName = e.currentTarget.dataset.target
- } else {
- this.modalName = null
- }
- this.listTouchDirection = null
- }
-
- }
- }
- </script>
- <style lang="scss">
- .cu-item {
- height: 180rpx !important
- }
- .plus {
- position: fixed;
- bottom: 3px;
- right: 3px;
- }
- </style>
|