Jelajahi Sumber

Merge branch 'V0.0.2' of http://10.87.10.227:4000/jzyd_yyds/soc_app into V0.0.2

coys 2 tahun lalu
induk
melakukan
154abf06cc

+ 0 - 3
src/components/Loading/loading/serve.js

@@ -20,14 +20,12 @@ LoadingConstructor.prototype.close = function() {
   if (this.fullscreen) {
     fullscreenLoading = undefined;
   }
-  console.log(this.$el,'666')
   this.$el.parentNode.removeChild(this.$el);
   this.$destroy();
   this.visible = false;
 };
 
 const Loading = (options = {}) => {
-  console.log(Vue.prototype.$isServer,'options')
   if (Vue.prototype.$isServer) return;
   if (typeof options.target === 'string') {
     options.target = document.querySelector(options.target);
@@ -43,7 +41,6 @@ const Loading = (options = {}) => {
   }
 
   let parent = options.body ? document.body : options.target;
-  console.log(parent,'parent')
   let instance = new LoadingConstructor({
     el: document.createElement('div'),
     data: options

+ 3 - 3
src/components/SearchSelectCell/index.vue

@@ -6,7 +6,7 @@
       :options="dataList"
       v-bind="$attrs"
       :showPicker="showPicker"
-      title="选择角色"
+      :title="title"
       :value-key="prop.label"
       :value="selected"
       @confirm="pickerConfirm"
@@ -29,8 +29,8 @@ export default {
     },
     //双向绑定的数据
     value:{
-      type: [String,Number],
-      default: null,
+      type:Array,
+      default: ()=>[],
     },
     required:{
       type: [Boolean,String],

+ 1 - 1
src/config/env.development.js

@@ -1,7 +1,7 @@
 /** 本地开发环境*/
 module.exports = {
   title: 'soc-app-dev',
-  baseUrl: 'http://10.87.10.55:8080/', // 项目地址
+  baseUrl: 'http://10.87.10.55:8080', // 本地图片地址
   baseApi: '/dev', // 本地api请求地址,注意:如果你使用了代理,请设置成'/'
   APPID: 'xxx',
   APPSECRET: 'xxx',

+ 6 - 0
src/router/router.config.js

@@ -232,6 +232,12 @@ export let routers = [
         component: () => import('@/views/menu/problemItem/detail'),
         meta: { title: '隐患问题详情', keepAlive: false }
       },
+      {
+        path: '/message',
+        name: 'message',
+        component: () => import('@/views/menu/message/index'),
+        meta: { title: '消息中心', keepAlive: false }
+      },
     ],
   },
 ]

+ 18 - 0
src/views/menu/message/api.js

@@ -0,0 +1,18 @@
+import request from "@/utils/request";
+//获取消息列表
+export function dataList(params) {
+  return request({
+    url: "/core/center/messageList",
+    method: "get",
+    params,
+  });
+}
+//获取计划列表
+export function msgList(data){
+  return request({
+    url: "/core/notification/appList",
+    method: "post",
+    data
+  });
+}
+

+ 188 - 0
src/views/menu/message/index.vue

@@ -0,0 +1,188 @@
+<template>
+<div class="message">
+  <NavBar />
+  <div v-if="!show" class="page-container">
+    <van-tabs v-model="query.type" @change="changeList">
+      <van-tab title="公告/通知" name="1"></van-tab>
+      <van-tab title="业务提醒" name="2"></van-tab>
+      <van-tab title="消息" name="3"></van-tab>
+    </van-tabs>
+    <div class="card-list">
+      <van-empty description="暂无数据" v-if="!dataList || dataList.length === 0" />
+      <Scroll
+        v-else
+        @pulldown="refreshData"
+        @pullup="getDataList"
+        :data='dataList'
+        :pullup="pullup"
+        class="wrapper"
+        ref="wrapper">
+        <van-cell-group  v-for="(v,i) in dataList">
+          <van-cell class="list-item" :title="v.title" :label="v.content" @click="clickItem(v)">
+            <template #right-icon>
+              <i  class="point-icon" :class="{'active':v.isRead}" />
+            </template>
+            <template #label>
+              <div class="cell-label">
+                <p >{{v.content}}</p>
+              </div>
+              <p class="cell-time">{{v.publishTime}}</p>
+            </template>
+          </van-cell>
+        </van-cell-group>
+      </Scroll>
+    </div>
+  </div>
+  <div v-else class="message-detail">
+    <van-panel v-if="selected" :title="selected.title" :desc="selected.orgName">
+      <div class="message-content">
+        <p>{{selected.content}}</p>
+        <p class="cell-time">{{selected.publishTime}}</p>
+      </div>
+    </van-panel>
+  </div>
+
+</div>
+</template>
+
+<script>
+import NavBar from '@/components/NavBar'
+import Scroll from '@/components/scroll/scroll'
+import {msgList,dataList} from './api'
+import {mapGetters} from "vuex";
+export default {
+  components: {
+    NavBar,
+    Scroll
+  },
+  data() {
+    return {
+      show:false,
+      selected:null,
+      dataList: [],
+      query:{
+        type:1,
+        pageNum:1,
+        pageSize:10,
+      },
+      pullup:false,
+    };
+  },
+  computed:{
+    ...mapGetters(['orgId','id','roleList'])
+  },
+  mounted(){
+    this.getDataList();
+  },
+  methods:{
+    clickItem(v){
+      this.selected = v;
+      this.show = true;
+    },
+    refreshData(){
+      this.getDataList();
+    },
+    changeList(v,type){
+      console.log(v,type,'type')
+      this.query.pageNum = 1;
+      this.getDataList();
+    },
+    getDataList(){
+      let data = {};
+      if(this.query.type == 1){
+        console.log(this.orgId,'tttttttttttt')
+        data = {
+          ...this.query,
+          userId:this.id,
+          orgId:this.orgId,
+          tagRoleIds:this.roleList.map(v=>{return v.roleId}),
+        }
+        msgList(data).then(res=>{
+          this.dataList = res.rows;
+        })
+        return;
+      }
+      data = {
+        ...this.query,
+        userId:this.id,
+      }
+      dataList(data).then(res=>{
+        this.dataList = res.rows;
+      })
+    }
+  }
+}
+</script>
+<style lang="scss">
+.message{
+  //.van-empty{
+  //  background-color: #fff;
+  //}
+  .van-cell-group{
+    background-color: #fff;
+  }
+  .van-tabs__line{
+    background-color: #008cd6;
+  }
+}
+</style>
+<style lang="scss" scoped>
+.message{
+
+}
+.card-list{
+  padding: 20px;
+  height: calc(100vh - 290px);
+  overflow:  auto;
+}
+.list-item{
+  margin-bottom: 20px;
+}
+.cell-label{
+  width: 100%;
+  padding: 10px;
+  min-height: 50px;
+  line-height: 36px;
+  max-height: 250px;
+  overflow: hidden;
+  >p{
+    word-break: break-word;
+    display: -webkit-box;
+    overflow: hidden;
+    text-overflow: ellipsis;
+    -webkit-line-clamp: 3;
+    -webkit-box-orient: vertical;
+    line-height: 40px;
+  }
+}
+.cell-time{
+  text-align: right;
+  height: 60px;
+  padding-top: 20px;
+}
+.point-icon{
+  width: 20px;
+  height: 20px;
+  background-color:#ccc;
+  border-radius: 50%;
+  margin-top: 10px;
+  display: none;
+  &.active{
+    display: block;
+    background-color: #03a5ff;
+  }
+}
+.message-detail{
+  height: calc(100vh - 192px);
+  background-color: #fff;
+}
+.message-content{
+  width: 100%;
+  padding:20px 30px;
+  overflow: auto;
+  >p{
+    word-break: break-word;
+    width: 100%;
+  }
+}
+</style>

+ 7 - 3
src/views/menu/securityCheckRegister/addCheck.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="addCheck">
-    <NavBar />
+    <NavBar :go="go"/>
     <div class="addCheck-container">
       <div class="search-flex">
         <van-search v-model="query.key" placeholder="请输入检查子项"  @change="refreshData"/>
@@ -66,6 +66,10 @@ export default {
         value:'id'
       },
       pullup:false,
+      go:{
+        type:'replace',
+        path:'/securityDetail',
+      }
     }
   },
   mounted(){
@@ -86,9 +90,8 @@ export default {
       this.selected = this.dataList.filter(v=>v.checked);
       if(this.selected.length === 0) return this.$toast('请选择检查项');
       sessionStorage.setItem('selected',JSON.stringify(this.selected));
-      this.$router.push({
+      this.$router.replace({
         path:'/securityDetail',
-        name:'securityDetail',
         query:{
           id:this.id,
         },
@@ -106,6 +109,7 @@ export default {
       checkList(this.query).then(res=>{
         res.rows.forEach(v=>{
           v.checked = false;
+          v.pointId = v.id;
         });
         this.query.pageNum === 1 ? this.dataList = res.rows : this.dataList = [...this.dataList,...res.rows];
         console.log(this.dataList.length,res.total,'this.dataList')

+ 6 - 2
src/views/menu/securityCheckRegister/addWorker.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="addWork">
-    <NavBar />
+    <NavBar :go="go"/>
     <div class="addWork-container">
       <div class="search-flex">
         <van-search v-model="query.name" placeholder="请输入姓名"  @change="refreshData"/>
@@ -68,6 +68,10 @@ export default {
         value:'id'
       },
       pullup:false,
+      go:{
+        type:'replace',
+        path:'/securityDetail',
+      }
     }
   },
   mounted(){
@@ -84,7 +88,7 @@ export default {
       this.formData.userId = this.selected;
       accredit(this.formData).then(res=>{
         this.$toast('授权成功');
-        this.$router.go(-2);
+        this.$router.replace({path:'/securityCheckRegister'});
       })
     },
     click(v,i){

+ 24 - 23
src/views/menu/securityCheckRegister/detail.vue

@@ -28,7 +28,7 @@
               <div v-for="(item,index) in v.pointList" :key="item.pointId">
                 <van-cell :title="item.pointName">
                   <template #right-icon>
-                    <img v-if="enable && item.nfcList.length > 0" :src="require('../../../assets/svg/NFC.svg')" class="nfc-icon" @click="clickNFC(item.nfcList)"/>
+                    <img v-if="enable && item.nfcList && item.nfcList.length > 0" :src="require('../../../assets/svg/NFC.svg')" class="nfc-icon" @click="clickNFC(item.nfcList)"/>
                     <van-switch
                       v-if="enable"
                       style="margin-left: 10px;"
@@ -46,7 +46,7 @@
                   </template>
                 </van-cell>
                 <van-cell-group v-show="item.status">
-                  <van-cell v-show="item.nfcList.length > 0" :border="false" >
+                  <van-cell v-if="item.nfcList && item.nfcList.length > 0" :border="false" >
                     <div v-if="img.img" class="nfc-img" v-for="(img,i) in item.nfcList" :key="img.img" @click="preViewNFC(i)">
                       <img :src="imgUrl(img.img)" alt="" >
                       <span>{{img.checkName}}</span>
@@ -164,36 +164,33 @@ export default {
       handler(val){
         console.log(val,'val')
         if(!val)return
-
-        val.forEach((valItem) => {
+        let str =  JSON.parse(JSON.stringify(val));
+        str.forEach((valItem) => {
           // 查找是否有与 valItem.itemId 相同的项
           const existingItem = this.checkList.find((checkItem) => checkItem.itemId === valItem.itemId);
-
           if (existingItem) {
-            // 如果存在相同 itemId 的项,查找 pointList 是否有与 valItem.pointId 相同的项
+            // // 如果存在相同 itemId 的项,查找 pointList 是否有与 valItem.pointId 相同的项
             const existingPoint = existingItem.pointList.find((pointItem) => pointItem.pointId === valItem.id);
-
             if (!existingPoint) {
               console.log(existingItem,'point添加成功')
-              // 如果不存在相同 pointId 的项,将 valItem 添加到 pointList 中
-              existingItem.pointList.push({
-                pointId: valItem.id,
-                pointName: valItem.pointName,
-                mustCheck: valItem.checked ? 1 : 0,
-              });
+              this.$nextTick(()=>{
+                existingItem.pointList.push(valItem);
+              })
+            }else {
+              this.$toast('该检查项已添加');
             }
           } else {
             console.log(valItem,'item添加成功')
-            // 如果不存在相同 itemId 的项,创建一个新的项并添加到 checkList 数组中
-            this.checkList.push({
-              itemId: valItem.itemId,
-              itemName: valItem.itemName,
-              pointList: [valItem],
-            });
+            this.$nextTick(()=>{
+              this.checkList.push({
+                itemId: valItem.itemId,
+                itemName: valItem.itemName,
+                pointList: [valItem],
+              });
+            })
           }
         });
       },
-      deep:true
     },
   },
   computed:{
@@ -261,7 +258,9 @@ export default {
       this.taskInfo.isSubmit = 0;
       registerSubmit(this.taskInfo).then(res=>{
         this.$toast('保存成功');
-        this.$router.go(-1);
+        this.$router.replace ({
+          path:'/securityCheckRegister',
+        });
       })
     },
 
@@ -284,7 +283,9 @@ export default {
       this.taskInfo.isSubmit = 1;
       registerSubmit(this.taskInfo).then(res=>{
         this.$toast('提交成功');
-        this.$router.go(-1);
+        this.$router.replace ({
+          path:'/securityCheckRegister',
+        });
       })
     },
 
@@ -325,7 +326,7 @@ export default {
     //切换开关时添加操作时间
     switchChange(item){
       console.log(item,'666')
-      item.resTime = formatDate(new Date());
+      //item.resTime = formatDate(new Date());
     },
     //添加图片时的回调
     changeNfcImg(imgItem){

+ 1 - 1
src/views/menu/securityCheckRegister/index.vue

@@ -144,7 +144,7 @@ export default {
         taskTime: null,
         checkOrgId:null,
         beCheckedOrgId:null,
-        roldIds:null,
+        roldIds:[],
         state:'1',
       },
       rolesList:[],