Commit 658d7065 authored by duanfy's avatar duanfy
Browse files

统一台账回显字段

parents ebdb5bf3 22fa4ff3
Loading
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -10,12 +10,15 @@

<template>
    <div>
        <!-- 加个吸顶 -->
        <van-sticky>
            <header class="header">
                <van-icon @click="to" name="arrow-left" class="iconColorLeft"/>
                <span>{{text}}</span>
                <!-- 为止有什么用图标注释 -->
                <!-- <van-icon name="bars" class="iconColorRight"/> -->
            </header>
        </van-sticky>
    </div>
</template>

+13 −4
Original line number Diff line number Diff line
@@ -262,6 +262,7 @@ const routes = [{
  },



  {
    path: '/add-danger',
    name: 'add-danger',
@@ -367,11 +368,12 @@ const routes = [{
    },
    component: () => import( /* webpackChunkName: "SaveWorkbench" */ '../views/danger/standBook'),
  },
  
  {
    path: '/normal-detail',
    name: 'normal-detail',
    meta: {
      title: '隐患历史台账详情',
      title: '隐患详情',
      index: 1
    },
    component: () => import( /* webpackChunkName: "SaveWorkbench" */ '../views/danger/standBook/normalDetail'),
@@ -532,8 +534,15 @@ const routes = [{
    component: () => import( /* webpackChunkName: "SaveWorkbench" */ '../views/risk/riskAccount/riskBigDetail'),
  },



  {
    path:'/insert-danger',
    name:'insert-danger',
    meta:{
      title:'我的上报',
      index:1
    },
    component:()=>import('@/views/danger/insertDanger/list')
  }
  
]

+27 −0
Original line number Diff line number Diff line
@@ -265,6 +265,33 @@ export function delayEdit(url, data) {
    })
}

// 隐患整改
export function list1(url="/rectification/list1", data) {
    return request({
        url,
        method: 'post',
        data
    })
}

// 隐患整改已退回
export function list2(url="/rectification/list2", data) {
    return request({
        url,
        method: 'post',
        data
    })
}

// 我的上报接口
export function myHDList(url="/hdreport/myHDList",data=null){
    return request({
        url,
        method:'post',
        data
    })
}




+11 −7
Original line number Diff line number Diff line
@@ -289,7 +289,7 @@ export default {
    LHeader,
  },
  activated(){
    this.taskId = this.$route.params.taskId;
    this.taskId = this.$route.params.taskId || localStorage.getItem('dangerAddTaskId');
    console.log(this.taskId );
    if (this.taskId) {
      this.isShowreturnCause = true;
@@ -297,9 +297,13 @@ export default {
      this.postReturnEcho();
    }
    this.getList();
  },
  
  mounted() {
    this.$bus.$on("sourceAyy", res => {
      this.source1 = res.join(",");
      // 销毁一下监听事件 不然会越加越多
      this.$bus.$off('riskLevelBus')
    });
  },
  beforeRouteLeave(to, from, next) {
@@ -341,6 +345,8 @@ export default {
      this.isShowreturnCause = false;
      this.returnCause = ""; // 退回原因
      this.currentDate = new Date()
      // 清空 localStorage
      localStorage.removeItem('dangerAddTaskId')
    }
    next();
  },
@@ -386,13 +392,10 @@ export default {
      currentDate : new Date()
    };
  },
  created() {
 
  },
  methods: {
    onSubmit(values) {
      let formdata = new FormData();

      formdata.append("proId", this.projectId);
      formdata.append("hdRange", values.hdRange);
      formdata.append("hdType", values.hdType);
@@ -423,6 +426,7 @@ export default {
      if (this.taskId) {
        url = `/hdreport/editSave/${this.taskId}`;
      }
      console.log(url);

      postHdReportAdd(url, formdata)
        .then((res) => {
+205 −87
Original line number Diff line number Diff line
<template>
  <div>
    <van-sticky>
      <LHeader :text="text"></LHeader>
    <van-search v-model="searchValue" placeholder="搜索" @search="onSearch" />
    </van-sticky>
    <!--  -->
    <!-- tab标签 -->
    <van-tabs
      @click="onClickTab"
      animated
      color="#2980F7"
      :sticky="true"
      offset-top="1.5rem"
    >
      <van-tab title="隐患整改">
        <!-- 内容列表 -->
        <div class="con-list" @touchmove="showIndex = null">
          <van-cell-group
@@ -57,17 +68,93 @@
        </div>
        <!-- 暂无数据 -->
        <div
      style="width: 100%;text-align: center; font-size: .48rem;position: fixed; top: 30%;"
          style="
            width: 100%;
            text-align: center;
            font-size: 0.48rem;
            position: fixed;
            top: 30%;
          "
          v-if="isHaveNews"
        >
          暂无数据
        </div>
      </van-tab>
      <van-tab title="隐患整改(已退回)">
        <!-- 内容列表 -->
        <div class="con-list" @touchmove="showIndex = null">
          <van-cell-group
            inset
            v-for="(item, index) in messageList"
            :key="index"
            @click="touchstart(index, item)"
          >
            <van-row gutter="">
              <van-col span="5">所属项目:</van-col>
              <van-col span="19">{{ item.proId }}</van-col>
            </van-row>
            <van-row gutter="">
              <van-col span="5">隐患级别:</van-col>
              <van-col span="19">{{ item.hdLev }}</van-col>
            </van-row>
            <van-row gutter="">
              <van-col span="5">适用范围:</van-col>
              <van-col span="19">{{ item.hdRange }}</van-col>
            </van-row>
            <van-row gutter="">
              <van-col span="5">隐患类型:</van-col>
              <van-col span="19">{{ item.hdType }}</van-col>
            </van-row>
            <van-row gutter="">
              <van-col span="5">发现时间:</van-col>
              <van-col span="19">{{ item.hdDiscoveryTime }}</van-col>
            </van-row>
            <van-row gutter="">
              <van-col span="5">超期标识:</van-col>
              <van-col span="19">{{ item.dueDate | formatTime }}</van-col>
            </van-row>
            <van-row gutter="">
              <van-col span="5">状态:</van-col>
              <van-col span="19">{{ item.taskName }}</van-col>
            </van-row>

            <!-- 长按显示遮罩层 -->
            <van-overlay :show="showIndex == index">
              <div class="wrapper" @click.stop="showIndex = null">
                <van-button round type="primary" @click="goDetail(item)"
                  >详情</van-button
                >
                <van-button round type="info" @click="goConfirm(item)"
                  >确认</van-button
                >
                <van-button round type="info" @click="goDelay(item)"
                  >延期</van-button
                >
              </div>
            </van-overlay>
          </van-cell-group>
        </div>
        <!-- 暂无数据 -->
        <div
          style="
            width: 100%;
            text-align: center;
            font-size: 0.48rem;
            position: fixed;
            top: 30%;
          "
          v-if="isHaveNews"
        >
          暂无数据
        </div>
      </van-tab>
    </van-tabs>
  </div>
</template>

<script>
import LHeader from "@/components/header.vue";
import { dangerRect } from "@/service/danger";
import { dangerRect, list1, list2 } from "@/service/danger";
export default {
  components: {
    LHeader,
@@ -79,39 +166,67 @@ export default {
      isHaveNews: false,
      messageList: [],
      Loop: "", // 定时器
      showIndex: null // 是否显示遮罩层
      showIndex: null, // 是否显示遮罩层
    };
  },
  created() {
    this.postList()
    this.onClickTab(0);
  },
  methods: {
      onSearch(val) {
    },
    postList(){
    onSearch(val) {},
    onClickTab(val) {
      this.showIndex = null;
      this.$toast.loading({
        message: "加载中...",
        forbidClick: true,
        loadingType: "spinner",
        duration: 0
        duration: 0,
      });
      dangerRect("/rectification/list").then(res =>{

      // 这里根据tab切换调用接口
      [list1, list2]
        [val]()
        .then((res) => {
          this.$toast.clear();
         this.messageList = res.rows
          this.messageList = res.rows;
          // 判断有无数据返回
          if (this.messageList.length == 0) {
            this.isHaveNews = true;
          }
      }).catch(() => {
        })
        .catch(() => {
          this.$toast.clear();
          this.$toast.fail("加载失败,请稍后再试");
        });
    },

    // 此接口暂时废弃
    // postList() {
    //   this.$toast.loading({
    //     message: "加载中...",
    //     forbidClick: true,
    //     loadingType: "spinner",
    //     duration: 0,
    //   });
    //   dangerRect("/rectification/list")
    //     .then((res) => {
    //       this.$toast.clear();
    //       this.messageList = res.rows;
    //       // 判断有无数据返回
    //       if (this.messageList.length == 0) {
    //         this.isHaveNews = true;
    //       }
    //     })
    //     .catch(() => {
    //       this.$toast.clear();
    //       this.$toast.fail("加载失败,请稍后再试");
    //     });
    // },

    touchstart(index, item) {
      if (this.showIndex != null) {
        this.showIndex = null;
        return
        return;
      }
      this.showIndex = index;
    },
@@ -121,8 +236,8 @@ export default {
      this.$router.push({
        name: "normal-detail",
        params: {
          id: data.taskId
        }
          id: data.taskId,
        },
      });
      this.showIndex = null;
    },
@@ -132,7 +247,7 @@ export default {
        name: "change-info",
        params: {
          data: data,
        }
        },
      });
      this.showIndex = null;
    },
@@ -141,30 +256,33 @@ export default {
      this.$router.push({
        name: "delay-info",
        params: {
          "taskId":data.taskId,
          "taskName":data.taskName
        }
          taskId: data.taskId,
          taskName: data.taskName,
        },
      });
      this.showIndex = null;
    }
    },
  },
  filters: {
    formatTime: function (val) {
      if (new Date(val).getTime() <= new Date().getTime()) {
          return "超期"
      }else if(new Date(val).getTime()>= new Date().getTime() &&  new Date(val).getTime()  <= new Date().getTime() + 259200000){
          return "临期"
        return "超期";
      } else if (
        new Date(val).getTime() >= new Date().getTime() &&
        new Date(val).getTime() <= new Date().getTime() + 259200000
      ) {
        return "临期";
      } else {
          return "正常"
      }
    }
        return "正常";
      }
    },
  },
};
</script>
<style lang="less" scoped>
/* @import url(); 引入css类 */
.con-list {
  padding: 10px 10px .533333rem;
  padding: 10px 10px 0.533333rem;
  background-color: #f0f1f5;
  .van-cell-group--inset {
    margin: 0;
@@ -173,8 +291,8 @@ export default {
    font-size: 13px;
    position: relative;
    .van-row {
      margin-bottom: .133333rem;
      line-height: .64rem;
      margin-bottom: 0.133333rem;
      line-height: 0.64rem;
    }
    .van-overlay {
      position: absolute;
Loading