|
@@ -1,271 +1,246 @@
|
|
|
<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="ListTouchStartCange"
|
|
|
+ @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 && pages > 1" style="padding-bottom: 60px">
|
|
|
+ <uni-load-more :status="loadStatus"></uni-load-more>
|
|
|
+ </view>
|
|
|
|
|
|
- <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>
|
|
|
+ <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()
|
|
|
- }
|
|
|
- },
|
|
|
+<script setup>
|
|
|
+import json from "../../../data/json.js";
|
|
|
+import { onLoad, onShow, onHide, onLaunch, onReachBottom, onNavigationBarButtonTap } from "@dcloudio/uni-app";
|
|
|
+import { ref, onMounted, inject, shallowRef, reactive, toRefs, watchEffect } from "vue";
|
|
|
+
|
|
|
+import useStore from "@/store/modules/user";
|
|
|
+import useXunJianStore from "@/store/modules/xunJian";
|
|
|
+
|
|
|
+import { del, index } from "@/api/setting/funReport.js";
|
|
|
+
|
|
|
+const funcReport = ref([]);
|
|
|
+const modalName = ref(null);
|
|
|
+const getData = ref([]);
|
|
|
+const dwtype = ref(0);
|
|
|
+const datetimerange = ref(["", ""]);
|
|
|
+
|
|
|
+const listTouchStart = ref(0);
|
|
|
+const listTouchDirection = ref(null);
|
|
|
+
|
|
|
+const flag = ref(false);
|
|
|
+
|
|
|
+const authListRes = ref(0);
|
|
|
+
|
|
|
+const pages = ref(1);
|
|
|
+const size = ref(12);
|
|
|
+const loadStatus = ref("loading"); //加载样式:more-加载前样式,loading-加载中样式,nomore-没有数据样式
|
|
|
+const isLoadMore = ref(false); //是否加载中
|
|
|
+const deleteStatus = ref(false);
|
|
|
+
|
|
|
+function loadData() {
|
|
|
+ getDeviceList({
|
|
|
+ company_code: uni.getStorageSync("selectedCode"),
|
|
|
+ start_time: datetimerange.value[0],
|
|
|
+ end_time: datetimerange.value[1],
|
|
|
+ pages: pages.value,
|
|
|
+ size: size.value,
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+// 设备类型数据请求
|
|
|
+function getDeviceList(params = {}) {
|
|
|
+ index(params).then((res) => {
|
|
|
+ if (deleteStatus.value) {
|
|
|
+ funcReport.value = [];
|
|
|
+ deleteStatus.value = false;
|
|
|
+ }
|
|
|
+ authListRes.value = 1;
|
|
|
+
|
|
|
+ if (res.data.totalcount) {
|
|
|
+ funcReport = res.data;
|
|
|
+ if (res.data.length < size.value) {
|
|
|
+ //判断接口返回数据量小于请求数据量,则表示此为最后一页
|
|
|
+
|
|
|
+ isLoadMore.value = true;
|
|
|
+ loadStatus.value = "nomore";
|
|
|
+ } else {
|
|
|
+ isLoadMore.value = false;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ isLoadMore.value = true;
|
|
|
+ loadStatus.value = "nomore";
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+//编辑
|
|
|
+function editItem(item) {
|
|
|
+ uni.redirectTo({
|
|
|
+ url: "/pages/setting/funReport/funcAdd/funcAdd?id=" + item.id + "",
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+//删除
|
|
|
+function deleteItem(item) {
|
|
|
+ let deleteT = 0;
|
|
|
+ deleteStatus.value = true;
|
|
|
+ uni.showModal({
|
|
|
+ title: "确认删除吗?",
|
|
|
+ content: "",
|
|
|
+ success: function (result) {
|
|
|
+ if (result.confirm) {
|
|
|
+ del({
|
|
|
+ id: item.id,
|
|
|
+ }).then((res) => {
|
|
|
+ if (!res.flag) {
|
|
|
+ alert("删除失败");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ getDeviceList({ company_code: uni.getStorageSync("selectedCode") });
|
|
|
+ });
|
|
|
+ } else if (result.cancel) {
|
|
|
+ console.log("用户点击取消");
|
|
|
+ }
|
|
|
+ }.bind(this),
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+// 新增
|
|
|
+function goAddPage(type) {
|
|
|
+ uni.redirectTo({
|
|
|
+ url: "/pages/setting/funReport/funcAdd/funcAdd",
|
|
|
+ success: (res) => {},
|
|
|
+ fail: () => {},
|
|
|
+ complete: () => {},
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+// ListTouch触摸开始
|
|
|
+function ListTouchStartCange(e) {
|
|
|
+ listTouchStart.value = e.touches[0].pageX;
|
|
|
+}
|
|
|
+
|
|
|
+// ListTouch计算方向
|
|
|
+function ListTouchMove(e) {
|
|
|
+ listTouchDirection.value = e.touches[0].pageX - listTouchStart.value < -80 ? "left" : "right";
|
|
|
+}
|
|
|
+
|
|
|
+// ListTouch计算滚动
|
|
|
+function ListTouchEnd(e) {
|
|
|
+ if (listTouchDirection.value == "left") {
|
|
|
+ modalName.value = e.currentTarget.dataset.target;
|
|
|
+ } else {
|
|
|
+ modalName.value = null;
|
|
|
+ }
|
|
|
+ listTouchDirection.value = null;
|
|
|
+}
|
|
|
|
|
|
- onLoad: function(option) {
|
|
|
- this.dwtype=option.dwtype
|
|
|
- this.loadData()
|
|
|
+function datetimerangeChage() {
|
|
|
+ funcReport.value = [];
|
|
|
+ pages.value = 1;
|
|
|
+ authListRes.value = [];
|
|
|
+ loadData();
|
|
|
+}
|
|
|
|
|
|
- },
|
|
|
- onNavigationBarButtonTap(e) {
|
|
|
- console.log(e)
|
|
|
- uni.navigateTo({
|
|
|
- url: './export/export?dwtype='+this.dwtype,
|
|
|
+watchEffect(() => {
|
|
|
+ datetimerangeChage();
|
|
|
+});
|
|
|
|
|
|
- });
|
|
|
- },
|
|
|
- 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
|
|
|
- })
|
|
|
-
|
|
|
- },
|
|
|
+onLoad((option) => {
|
|
|
+ dwtype.value = option.dwtype;
|
|
|
+ loadData();
|
|
|
+});
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- // 设备类型数据请求
|
|
|
- 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
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
+onReachBottom(() => {
|
|
|
+ //上拉触底函数
|
|
|
+ if (!isLoadMore.value) {
|
|
|
+ //此处判断,上锁,防止重复请求
|
|
|
+ isLoadMore.value = true;
|
|
|
+ pages.value += 1;
|
|
|
+ loadData();
|
|
|
+ }
|
|
|
+});
|
|
|
|
|
|
- }
|
|
|
+onNavigationBarButtonTap((e) => {
|
|
|
+ console.log(e);
|
|
|
+ uni.navigateTo({
|
|
|
+ url: "./export/export?dwtype=" + dwtype.value,
|
|
|
+ });
|
|
|
+});
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
|
- .cu-item {
|
|
|
- height: 180rpx !important
|
|
|
- }
|
|
|
- .plus {
|
|
|
- position: fixed;
|
|
|
- bottom: 3px;
|
|
|
- right: 3px;
|
|
|
- }
|
|
|
+.cu-item {
|
|
|
+ height: 180rpx !important;
|
|
|
+}
|
|
|
+.plus {
|
|
|
+ position: fixed;
|
|
|
+ bottom: 3px;
|
|
|
+ right: 3px;
|
|
|
+}
|
|
|
</style>
|