王飞
2025-03-07 c5e49c10499435802a6551b98772f95660c6f85a
pages/index/main.vue
@@ -5,7 +5,7 @@
      <!-- 顶部自定义导航 -->
      <!-- <view class=""> -->
      <tn-nav-bar fixed>
      <tn-nav-bar fixed :isBack="false">
         <text class="page-title">信息</text>
      </tn-nav-bar>
      <!-- </view> -->
@@ -16,7 +16,7 @@
            style="margin-top: 100px;">
            <view v-for="(item, index) in list" :key="index">
               <view>
                  <tn-button class="modal-btn" backgroundColor="#01BEFF" size="sm"
                     @click="itemClick(item,index)">处理</tn-button>
@@ -141,6 +141,7 @@
         }, 400)
      },
      onLoad() {
         console.log(4444444);
         this.lock = false
      },
@@ -152,27 +153,29 @@
            const params = {
               ids: this.checkboxValue1
            }
            moreprocessingWarn(params).then((res) => {
               if (res.code == 0) {
                  this.$refs.refSuccess.showBox({
                     type: 'success',
                     txt: '处理成功'
                  });
                  this.show = false
                  // location.reload();
                  this.handleRefresh({
                     page: 1,
                     size: this.pageSize
                  }, () => {
                     // 可以在这里处理加载完成后的逻辑
                  });
               } else {
                  this.$refs.refSuccess.showBox({
                     type: 'error',
                     txt: '处理失败'
                  });
               }
            })
            if (this.vuex_is_login) {
               moreprocessingWarn(params).then((res) => {
                  if (res.code == 0) {
                     this.$refs.refSuccess.showBox({
                        type: 'success',
                        txt: '处理成功'
                     });
                     this.show = false
                     // location.reload();
                     this.handleRefresh({
                        page: 1,
                        size: this.pageSize
                     }, () => {
                        // 可以在这里处理加载完成后的逻辑
                     });
                  } else {
                     this.$refs.refSuccess.showBox({
                        type: 'error',
                        txt: '处理失败'
                     });
                  }
               })
            }
         },
         checkboxChange(n) {
            this.show = true
@@ -195,24 +198,30 @@
               size: data.size,
               company: this.company,
            }
            if (this.vuex_is_login) {
               findwarning(params).then((res) => {
            findwarning(params).then((res) => {
               console.log(res);
               if (res.code == 0) {
                  let list = [];
                  setTimeout(() => {
                     let list = res.data.map(item => ({
                        ...item,
                        checked: false // 初始化checked属性为false
                     }));
                     this.list = [...this.list, ...list];
                     callback({
                        list: this.list,
                        total: res.data.length
                     });
                  }, 1500);
               }
            })
                  if (res.code == 0) {
                     let list = [];
                     setTimeout(() => {
                        let list = res.data.map(item => ({
                           ...item,
                           checked: false // 初始化checked属性为false
                        }));
                        this.list = [...this.list, ...list];
                        callback({
                           list: this.list,
                           total: res.data.length
                        });
                     }, 1500);
                  }
               })
            }else{
               callback({
                  list: [],
                  total: 0
               });
            }
         },
         handleSearch(data, callback) {
            const params = {
@@ -221,52 +230,55 @@
               objectid: this.keyword,
               company: this.company,
            }
            findwarning(params).then((res) => {
               this.list = []
               if (res.code == 0) {
                  let list = [];
                  setTimeout(() => {
            if (this.vuex_is_login) {
               findwarning(params).then((res) => {
                  this.list = []
                  if (res.code == 0) {
                     let list = [];
                     for (var i = 0; i < res.data.length; i++) {
                        list.push(res.data[i]);
                     }
                     this.list = [...this.list, ...list];
                     callback({
                        list: this.list,
                        total: res.data.length
                     });
                  }, 1500);
               }
            })
                     setTimeout(() => {
                        let list = [];
                        for (var i = 0; i < res.data.length; i++) {
                           list.push(res.data[i]);
                        }
                        this.list = [...this.list, ...list];
                        callback({
                           list: this.list,
                           total: res.data.length
                        });
                     }, 1500);
                  }
               })
            }
         },
         // 模拟请求数据刷新
         handleRefresh(data, callback) {
            const params = {
               current: data.page,
               size: data.size,
               objectid: data.objectid,
               company: this.company,
            }
            findwarning(params).then((res) => {
               if (res.code == 0) {
                  let list = [];
                  setTimeout(() => {
            if (this.vuex_is_login) {
               findwarning(params).then((res) => {
                  if (res.code == 0) {
                     let list = [];
                     for (var i = 0; i < res.data.length; i++) {
                        list.push(res.data[i]);
                     }
                     this.list = []
                     this.list = [...this.list, ...list];
                     callback({
                        list: this.list,
                        total: res.data.length
                     });
                  }, 1500);
               }
            })
                     setTimeout(() => {
                        let list = [];
                        for (var i = 0; i < res.data.length; i++) {
                           list.push(res.data[i]);
                        }
                        this.list = []
                        this.list = [...this.list, ...list];
                        callback({
                           list: this.list,
                           total: res.data.length
                        });
                     }, 1500);
                  }
               })
            }
         },
         itemClick(item, index) {
            console.log('点击了', item);
            this.lock = true
            this.warlist = item
            this.warnindex = index
@@ -276,7 +288,7 @@
         },
         prosuccess(e) {
            this.lock = false
            if (e == '已处理') {
               this.$refs.refSuccess.showBox({
                  type: 'success',