gaoxiong 1 год назад
Родитель
Сommit
2f64922a55

+ 1 - 0
package.json

@@ -29,6 +29,7 @@
     "gm-crypt": "0.0.2",
     "js-image-compressor": "^2.0.0",
     "liquor-tree": "^0.2.70",
+    "lodash": "^4.17.21",
     "node-polyfill-webpack-plugin": "^3.0.0",
     "pdfjs-dist": "2.5.207",
     "regenerator-runtime": "^0.13.5",

+ 85 - 26
src/components/TopBar.vue

@@ -28,19 +28,19 @@
           :src="require('@/assets/img/my/header.png')"
         />
         <div class="user-name">
-         {{ getShowUserName() }}    
+         {{ getShowUserName() }}
         </div>
         <!-- <div style="line-height: 11vw;" v-if="subUserActions && subUserActions.length>0">
-            <van-popover v-model="showPopover" placement="left-end" trigger="click" 
-              :actions="subUserActions"          
-              @select="onSelect">         
+            <van-popover v-model="showPopover" placement="left-end" trigger="click"
+              :actions="subUserActions"
+              @select="onSelect">
               <template #reference>
                 <van-button size="mini" icon="exchange" round  type="info">切换机构</van-button>
               </template>
           </van-popover>
         </div> -->
-        
-      
+
+
       </div>
       <div class="top-card-line" style="display: flex;">
         <div style="-webkit-box-flex: 1;-webkit-flex: 1;flex: 1;">
@@ -55,13 +55,36 @@
         </p>
        </div>
         <div  v-if="subUserActions && subUserActions.length>0">
-            <van-popover v-model="showPopover" placement="left-end" trigger="click" class="xxxx"
-              :actions="subUserActions"          
-              @select="onSelect">         
+
+          <van-dialog v-model="showPopover" title="切换机构" width="95%" @confirm="onSelect" show-cancel-button>
+            <van-row class="rowclss">
+              <van-col span="24">
+                <van-radio-group  v-model="peoplesId">
+                  <van-cell-group>
+                    <van-cell v-for="item in subUserActions" clickable :key="item.subUserId"  :name="item.subUserId">
+                      <template #title>
+                        <span :class="item.haveUnDoTask ? 'custom-required-indicator' : 'custom-no-indicator'">
+                          {{item.text}}
+                        </span>
+                      </template>
+                      <template #right-icon>
+                        <van-radio :name="item.subUserId" />
+                      </template>
+                    </van-cell>
+
+                  </van-cell-group>
+                </van-radio-group >
+              </van-col>
+            </van-row>
+          </van-dialog>
+          <van-button size="mini" round icon="exchange"  type="default" @click="showDailog">切换机构</van-button>
+<!--            <van-popover v-model="showPopover" placement="left-end" trigger="click" class="xxxx"
+              :actions="subUserActions"
+              @select="onSelect">
               <template #reference>
                 <van-button size="mini" round icon="exchange"  type="default">切换机构</van-button>
               </template>
-          </van-popover>
+          </van-popover>-->
         </div>
       </div>
       <div class="top-card-line">
@@ -78,7 +101,7 @@
       <div style="height: 2vw;"></div>
     </div>
     <div class="card-footer"></div>
-    
+
   </div>
 </template>
 <script>
@@ -88,13 +111,14 @@
     data() {
       return {
         showPopover:false,
+        peoplesId:null,
         subUserActions: [],
       }
     },
     created(){
     },
     mounted(){
-      
+
     },
     watch:{
       subUserList:{
@@ -111,6 +135,9 @@
       ...mapGetters(['userName', 'orgName','roleList', 'orgId','subUserList','masterUserName','masterUserId']),
     },
     methods: {
+      showDailog(){
+        this.showPopover=true;
+      },
       getShowUserName()
       {
         // console.log("getShowUserName",this.masterUserName ,this.masterUserId)
@@ -124,14 +151,14 @@
         }
       },
       initSubUserActions(){
-         console.log("initSubUserActions",this.subUserList)        
+         console.log("initSubUserActions",this.subUserList)
         if(this.subUserList && this.subUserList.length>0)
         {
           this.getSubUserUnDoTaskList();
         }
       },
       clickSwitchUser(subUserId)
-      {        
+      {
         switchUser(subUserId).then(res => {
           // console.log(res, 'res')
           sessionStorage.clear();
@@ -147,7 +174,7 @@
       onSelect(action)
       {
         // console.log("onSelect",action,action.text);
-        this.clickSwitchUser(action.subUserId);
+        this.clickSwitchUser(this.peoplesId);
       },
       getSubUserUnDoTaskList()
       {
@@ -157,7 +184,7 @@
             return {userId:i.subUserId,orgId:i.subUserOrgId};
           } );
           userUnDoList(users).then(res => {
-            
+
           // console.log("initSubUserActions2",this.subUserList)
           this.subUserActions=[];
           this.subUserList.forEach(sUser => {
@@ -168,15 +195,15 @@
               {
                 haveUnDoTask=true;
               }
-            }            
-            // let tempText= `${sUser.subUserOrgName}`; 
-            let tempAction={ text: sUser.subUserOrgName,subUserId:sUser.subUserId};
+            }
+            // let tempText= `${sUser.subUserOrgName}`;
+            let tempAction={ text: sUser.subUserOrgName,subUserId:sUser.subUserId,haveUnDoTask:haveUnDoTask};
             if(haveUnDoTask)
             {
               tempAction={className:"haveUnDoTask",...tempAction};
             }
             this.subUserActions.push(tempAction)
-          
+
           });
           // console.log("xxx",this.subUserActions)
           })
@@ -188,7 +215,7 @@
           this.$router.replace('/login');
           this.$toast('退出登录');
         })
-      }      
+      }
     }
   }
 </script>
@@ -199,11 +226,11 @@
       flex:none !important;
     }
   }
- 
+
   .haveUnDoTask
   {
     .van-popover__action-text::before{
-      content: "";      
+      content: "";
       width:10px;
       height:10px;
       background-color: red;
@@ -213,9 +240,9 @@
     }
   }
 </style>
-<style scoped lang="scss"> 
-  
-  
+<style scoped lang="scss">
+
+
   .card-footer{
     height: 3vw;
   }
@@ -292,4 +319,36 @@
       }
     }
   }
+  .rowclss {
+    // height: 1050px;
+    max-height: calc(80vh - 180px);
+    min-height: 200px;
+    // height: calc(100vh - 490px);
+    overflow: scroll;
+
+  }
+
+  .custom-required-indicator::before {
+    content: '';
+    display: inline-block;
+    width: 10px;
+    height: 10px;
+    margin-right: 4px;
+    background-color: red;
+    border-radius: 50%;
+    vertical-align: middle;
+  }
+  .custom-no-indicator::before {
+    content: '';
+    display: inline-block;
+    width: 6px;
+    height: 6px;
+    margin-right: 4px;
+    background-color: #ffffff;
+    border-radius: 50%;
+    vertical-align: middle;
+  }
+  ::v-deep .van-dialog{
+    top: 50% !important;
+  }
 </style>

+ 183 - 0
src/components/dateCell/search.vue

@@ -0,0 +1,183 @@
+<template>
+  <div class="date-cell" >
+    <van-cell :title="title" clickable  :label="!isRow?label:''" :center="true" @click="clickItem">
+      <template #right-icon>
+        <van-icon name="notes-o" class="date-icon"/>
+      </template>
+    </van-cell>
+    <van-popup v-model="showPicker" round  position="bottom" :close-on-popstate="true" get-container="#app">
+      <!--格式化日期-->
+      <!--:formatter="formatter"-->
+      <van-datetime-picker
+        v-bind="$attrs"
+        show-toolbar
+        v-model="selected"
+        :type="dateType"
+        :columns="columns"
+        :formatter="formatter"
+        @cancel="cancelPicker"
+        @confirm="pickerConfirm"
+        confirm-button-text="确定"
+      />
+
+    </van-popup>
+  </div>
+</template>
+
+<script>
+
+import dayjs from "dayjs";
+import {formatDate} from "@/filters/filter";
+
+export default {
+  props:{
+    disabled:{
+      type: [Boolean,String],
+      default: false,
+    },
+    //默认值
+    value:{
+      type: String,
+      default: null,
+    },
+    //标题
+    title:{
+      type: String,
+      default: null,
+    },
+    //时间类型,见van-datetime-picker
+    dateType:{
+      type: String,
+      default: 'date',
+    },
+    //单行显示或者多行显示
+    isRow:{
+      type: Boolean,
+      default: false,
+    },
+    isAll:{
+      type: Boolean,
+      default: false,
+    },
+    required:{
+      type: [Boolean,String],
+      default: false,
+    },
+  },
+  data(){
+    return{
+      showPicker:false,
+      selected:null,
+      columns: [],
+      defaultTime:null,
+      type: {
+        'date': {value: 'YYYY-MM-DD'},
+        'year-month':{ value: 'YYYY-MM'},
+        'month-day': {value: 'MM-DD'},
+        'datetime':{ value: 'YYYY-MM-DD HH:mm:ss'},
+      },
+      label:'',
+    }
+  },
+  watch:{
+    value:{
+      handler (val) {
+        console.log(val,'valllll')
+        if(!val){
+          if(this.isAll){
+            this.label = '全部';
+          }else {
+            this.label = '';
+          }
+          this.selected = null;
+        }else{
+          this.selected = dayjs(val).toDate();
+          this.label = formatDate(val,this.type[this.dateType].value);
+        }
+      },
+      immediate: true
+    }
+  },
+  created() {
+    //初始化时间
+    this.selected = new Date();
+  },
+  methods:{
+    formatter(type, val) {
+      if (type === 'year') {
+        return val + '年';
+      }
+      if (type === 'month') {
+        return val + '月';
+      }
+      if (type === 'day') {
+        return val + '日';
+      }
+      if (type === 'hour') {
+        return val + '时';
+      }
+      if (type === 'minute') {
+        return val + '分';
+      }
+      return val;
+    },
+    cancelPicker(){
+      this.showPicker = false;
+    },
+    pickerConfirm(val){
+      this.selected = val;
+      this.label = formatDate(val,this.type[this.dateType].value);
+      this.showPicker = false;
+      this.$emit('change',this.label)
+    },
+    clickItem(){
+      this.showPicker = true;
+    },
+  },
+  model:{
+    prop: 'value',
+    event: 'change',
+  }
+}
+</script>
+
+<style lang="scss">
+.date-cell{
+  .date-icon{
+    font-weight: 500;
+    width: 42px;
+    height: 6.4vw;
+    color: #969799;
+    font-size: 42px;
+    line-height: 6.4vw;
+  }
+  .van-cell__label{
+    margin: 0;
+  }
+  .van-cell__value{
+    padding-right: 10px;
+  }
+}
+</style>
+<style lang="scss" scoped>
+.date-cell{
+  position: relative;
+  box-sizing: border-box;
+  width: 100%;
+  overflow: hidden;
+  color: #323233;
+  background-color: #fff;
+}
+.date-cell::after{
+  position: absolute;
+  box-sizing: border-box;
+  content: ' ';
+  pointer-events: none;
+  right: 30px;
+  bottom: 0;
+  left: 30px;
+  border-bottom: 1px solid #ebedf0;
+  -webkit-transform: scaleY(.5);
+  transform: scaleY(.5);
+}
+</style>

+ 41 - 6
src/components/peopleList/index.vue

@@ -10,7 +10,8 @@
       placeholder="请选择人员"
       @click="show = true"
     />
-    <van-action-sheet class="bigsheetbox" @closed="closedHandler" v-model="show" safe-area-inset-bottom position="bottom" title="选择人员">
+
+    <van-dialog v-model="show" width="95%" title="选择人员" @confirm="submitHandler" confirm-button-color="#1989fa" show-cancel-button>
       <van-row>
         <van-col span="24">
           <!-- <van-search v-model="searchVal" placeholder="请输入搜索关键词" /> -->
@@ -29,7 +30,38 @@
                   <van-checkbox :name="item.id" />
                 </template>
               </van-cell>
-            
+
+            </van-cell-group>
+          </van-checkbox-group>
+        </van-col>
+      </van-row>
+<!--      <van-row class="bottomdiv">
+        <van-col span="24">
+          <van-button class="btns" size="large" type="info" @click="submitHandler">确定</van-button>
+        </van-col>
+      </van-row>-->
+    </van-dialog>
+
+<!--    <van-action-sheet class="bigsheetbox" @closed="closedHandler" v-model="show" safe-area-inset-bottom position="bottom" title="选择人员">
+      <van-row>
+        <van-col span="24">
+          &lt;!&ndash; <van-search v-model="searchVal" placeholder="请输入搜索关键词" /> &ndash;&gt;
+          <form action="/">
+            <van-search v-model="searchVal" placeholder="请输入搜索关键词" clearable @input="onSearch" />
+          </form>
+        </van-col>
+      </van-row>
+
+      <van-row class="rowclss">
+        <van-col span="24">
+          <van-checkbox-group v-model="peoplesId">
+            <van-cell-group>
+              <van-cell v-for="item in peopleListCpoy" clickable :key="item.id" :title="`${item.name}`">
+                <template #right-icon>
+                  <van-checkbox :name="item.id" />
+                </template>
+              </van-cell>
+
             </van-cell-group>
           </van-checkbox-group>
         </van-col>
@@ -39,7 +71,7 @@
           <van-button class="btns" size="large" type="info" @click="submitHandler">确定</van-button>
         </van-col>
       </van-row>
-    </van-action-sheet>
+    </van-action-sheet>-->
   </div>
 </template>
 <script>
@@ -207,13 +239,13 @@ export default {
 }
 .rowclss {
   // height: 1050px;
-  height: calc(100vh - 180px);
+  height: calc(80vh - 180px);
   // height: calc(100vh - 490px);
   overflow: scroll;
-  
+
 }
 .bigsheetbox {
-   height: calc(100vh - 100px);
+  height: calc(80vh - 200px);
 }
 .van-field__control {
   padding-right: 20px;
@@ -223,4 +255,7 @@ export default {
   height: 3px;
   background-color: #1989fa;
 }
+::v-deep .van-dialog{
+  top: 50% !important;
+}
 </style>

+ 226 - 0
src/components/peopleList/index_bak.vue

@@ -0,0 +1,226 @@
+<template>
+  <div>
+    <van-field
+      readonly
+      clickable
+      name="datetimePicker"
+      v-model="peoples"
+      :required="isRequired"
+      :label="inpitLabel"
+      placeholder="请选择人员"
+      @click="show = true"
+    />
+    <van-action-sheet class="bigsheetbox" @closed="closedHandler" v-model="show" safe-area-inset-bottom position="top" title="选择人员">
+      <van-row>
+        <van-col span="24">
+          <!-- <van-search v-model="searchVal" placeholder="请输入搜索关键词" /> -->
+          <form action="/">
+            <van-search v-model="searchVal" placeholder="请输入搜索关键词" clearable @input="onSearch" />
+          </form>
+        </van-col>
+      </van-row>
+
+      <van-row class="rowclss">
+        <van-col span="24">
+          <van-checkbox-group v-model="peoplesId">
+            <van-cell-group>
+              <van-cell v-for="item in peopleListCpoy" clickable :key="item.id" :title="`${item.name}`">
+                <template #right-icon>
+                  <van-checkbox :name="item.id" />
+                </template>
+              </van-cell>
+
+            </van-cell-group>
+          </van-checkbox-group>
+        </van-col>
+      </van-row>
+      <van-row class="bottomdiv">
+        <van-col span="24">
+          <van-button class="btns" size="large" type="info" @click="submitHandler">确定</van-button>
+        </van-col>
+      </van-row>
+    </van-action-sheet>
+  </div>
+</template>
+<script>
+import { deptTreeList } from '@/api/toConsult.js'
+import { getOrgPeople } from '@/api/public.js'
+import OrgTree from '@/components/orgTree'
+export default {
+  name: 'SocAppIndex',
+  components: {
+    OrgTree
+  },
+
+  props: {
+    organizationId: {
+      //机构ID
+    },
+    userList: {
+      type: Array,
+      default: () => {
+        return []
+      }
+    },
+    isRequired: {
+      //是否必填
+      type: Boolean,
+      default: false
+    },
+    inpitLabel: {
+      type: String,
+      default: '参与人员'
+    },
+    fieldNames: {
+      //树行配置映射项
+      type: Object,
+      default: () => {
+        return {
+          text: 'name',
+          value: 'id',
+          children: 'children'
+        }
+      }
+    }
+  },
+  data() {
+    return {
+      orgId: this.organizationId || '',
+      show: false,
+      value1: '',
+      showcascader: false,
+      cascaderValue: '',
+      loading: false,
+      options: [], //机构列表
+      peoplesId: [], //人员ID集合
+      searchVal: '', //搜索值
+      peopleList: [], //人员列表
+      peopleListCpoy: [], //人员列表2
+      orgName: '', //机构名称
+      peoples: '' //人员列表
+    }
+  },
+  watch: {
+    organizationId(val) {
+      this.orgId = val + ''
+      this.getpeople()
+    },
+    //监听弹框是否打开
+    show(val) {
+      if (val) {
+        this.getpeople()
+      }
+    },
+    //监听人员数组变化
+    userList(val) {
+      this.peoplesId = []
+      this.$set(this.$data, 'peoples', val.map(item => item.userName).join(','))
+
+      val.map(item => {
+        this.peoplesId.push(item.userId)
+      })
+    }
+  },
+
+  created() {},
+  mounted() {},
+
+  methods: {
+    // 弹框关闭动画
+    closedHandler() {
+      this.searchVal = ''
+    },
+    onLoad() {},
+    getpeople() {
+      getOrgPeople(this.orgId).then(res => {
+        let { code, data, msg } = res
+        if (code == 200) {
+          this.peopleList = data
+          this.peopleList.forEach(item => {
+            item.userName = item.name
+            item.username = item.name
+            item.userId = item.id
+          })
+          this.peopleListCpoy = JSON.parse(JSON.stringify(this.peopleList))
+
+          this.peopleListCpoy.forEach(item => {
+            this.peoplesId.forEach(i => {
+              console.log(this.peoplesId)
+              if (item.userId === i) {
+                this.$set(item, 'checked', true)
+              } else {
+                this.$set(item, 'checked', false)
+              }
+            })
+          })
+        }
+      })
+    },
+
+    onSearch(val) {
+      this.peopleListCpoy = this.peopleList.filter(item => {
+        if (item.name.indexOf(val) != -1) {
+          return item
+        }
+      })
+    },
+
+    onCancel() {
+      this.searchVal = ''
+      this.peopleListCpoy = this.peopleList
+    },
+    submitHandler() {
+      let list = []
+      this.peopleListCpoy.filter(item => {
+        this.peoplesId.forEach(r => {
+          if (r == item.id) {
+            list.push(item)
+          }
+        })
+      })
+
+      // this.peoples = list.map(item => item.name).join(',')
+
+      this.$set(this.$data, 'peoples', list.map(item => item.name).join(','))
+      // 抛出已选择人员信息
+      this.$emit('userList', list)
+      this.show = false
+    }
+  }
+}
+</script>
+<style lang="scss" scoped>
+.van-action-sheet {
+  min-height: 90%;
+}
+.btns {
+  width: 100%;
+  height: 90px;
+}
+.bottomdiv {
+  width: 100%;
+  bottom: 0%;
+  position: absolute;
+  margin-top: 20px;
+  z-index: 2000;
+  padding-bottom:calc(0 + env(safe-area-inset-bottom));
+}
+.rowclss {
+  // height: 1050px;
+  height: calc(100vh - 180px);
+  // height: calc(100vh - 490px);
+  overflow: scroll;
+
+}
+.bigsheetbox {
+   height: calc(80vh - 300px);
+}
+.van-field__control {
+  padding-right: 20px;
+}
+.line {
+  width: 100%;
+  height: 3px;
+  background-color: #1989fa;
+}
+</style>

+ 178 - 0
src/components/selectCell/search.vue

@@ -0,0 +1,178 @@
+<template>
+  <div class="select-cell">
+    <van-cell
+      :required="required"
+      :title="title"
+      :border="border"
+      :value="isRow?label:null"
+      :label="!isRow?label:null"
+      :center="true"
+      is-link
+      @click="clickItem"/>
+    <!-- :label="!isRow?label:null" -->
+    <van-popup v-model="showPicker" round lazy-render position="bottom" :close-on-popstate="true" get-container="#app">
+      <van-picker
+        v-bind="$attrs"
+        show-toolbar
+        :value-key="prop.label"
+        v-model="selected"
+        :columns="columns"
+        @confirm="pickerConfirm"
+        confirm-button-text="确定"
+        @cancel="cancelPicker"
+      />
+    </van-popup>
+  </div>
+</template>
+
+<script>
+import {getDict} from "@/api/toConsult";
+export default {
+  props:{
+    //禁用
+    disabled:{
+      type: [Boolean,String],
+      default: false,
+    },
+    //双向绑定的数据
+    value:{
+      type: [String,Number],
+      default: null,
+    },
+    required:{
+      type: [Boolean,String],
+      default: false,
+    },
+    border:{
+      type: [Boolean,String],
+      default: false,
+    },
+    //标题
+    title:{
+      type: String,
+      default: null,
+    },
+    //父组件给的列表数据
+    dataList:{
+      type: Array,
+      default: ()=>[],
+    },
+    //是否显示全部选项
+    isAll:{
+      type: Boolean,
+      default: false,
+    },
+    //单行显示或者多行显示
+    isRow:{
+      type: Boolean,
+      default: false,
+    },
+    //自定义字段
+    prop:{
+      type: Object,
+      default: ()=>(
+        {
+          label:'dictLabel',
+          value:'dictValue'
+        }
+      ) ,
+    }
+  },
+  data(){
+    return{
+      showPicker:false,
+      label:'无',
+    }
+  },
+  computed:{
+    columns(){
+      console.log(this.dataList,'datalist')
+      if(this.isAll){
+        let obj = {};
+        obj[this.prop.label] = '全部';
+        obj[this.prop.value] = null;
+        if(this.dataList)
+        { // 如果 this.dataList 为null undefine 解构会报错
+          return [obj,...this.dataList];
+        }
+        else
+        {
+          return [obj]
+        }
+      }
+      return this.dataList;
+    },
+    selected(){
+      if(!this.value) {
+        if(this.isAll){
+          this.label = '全部';
+          return null;
+        }
+        this.label = '无';
+        return null;
+      }
+      let val;
+      console.log(this.label,'label1111');
+      this.columns.forEach(v=> {
+        if (v[this.prop.value] === this.value) {
+          val = v;
+          this.label = v[this.prop.label];
+          console.log(this.label,'label2222');
+        }
+      });
+      return val;
+    },
+  },
+  methods:{
+    cancelPicker(){
+      this.showPicker = false;
+    },
+    pickerConfirm(val){
+      console.log(val,'val')
+      if(!val) return;
+      this.label = val[this.prop.label];
+      console.log(this.label,'label')
+      this.showPicker = false;
+      this.$emit('change',val[this.prop.value]);
+      this.$emit('itemInfo',val)
+    },
+    clickItem(){
+      this.showPicker = true;
+    },
+  },
+  model:{
+    prop: 'value',
+    event: 'change',
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.select-cell{
+  position: relative;
+  box-sizing: border-box;
+  width: 100%;
+  overflow: hidden;
+  color: #323233;
+  background-color: #fff;
+}
+.select-cell::after{
+  position: absolute;
+  box-sizing: border-box;
+  content: ' ';
+  pointer-events: none;
+  right: 30px;
+  bottom: 0;
+  left: 30px;
+  border-bottom: 1px solid #ebedf0;
+  -webkit-transform: scaleY(.5);
+  transform: scaleY(.5);
+}
+.van-cell__label{
+  margin: 0;
+  white-space: nowrap;
+  text-overflow: ellipsis;
+  overflow: hidden;
+  width: 260px;
+}
+</style>

+ 26 - 18
src/utils/onresizeMixins.js

@@ -1,31 +1,39 @@
+import { debounce } from 'lodash';
 export const onresizeHandler = {
-  
   data() {
     return {
-      docmHeight: document.documentElement.clientHeight || document.body.clientHeight,
-      showHeight: document.documentElement.clientHeight || document.body.clientHeight,
-      isBtn: true //是否显示隐藏保存提交按钮(演练登记&教育培训)
+      docmHeight: this.getDocumentHeight(),
+      showHeight: this.getDocumentHeight(),
+      isBtn: true // 是否显示隐藏保存提交按钮(演练登记&教育培训)
     }
   },
   created() {},
   watch: {
-    //监听显示高度
-    showHeight: function () {
-      if (this.docmHeight > this.showHeight) {
-        //隐藏
-        this.isBtn = false
-      } else {
-        //显示
-        this.isBtn = true
-      }
+    // 监听显示高度
+    showHeight: function() {
+      this.updateButtonVisibility();
     }
   },
   mounted() {
-    //监听事件
-    window.onresize = () => {
-      return (() => {
-        this.showHeight = document.documentElement.clientHeight || document.body.clientHeight
-      })()
+    // 添加事件监听器,并使用防抖处理函数
+    window.addEventListener('resize', this.handleResize);
+  },
+  beforeDestroy() {
+    // 移除事件监听器,避免内存泄漏
+    window.removeEventListener('resize', this.handleResize);
+  },
+  methods: {
+    handleResize: debounce(function() {
+      this.showHeight = this.getDocumentHeight();
+    }, 100), // 使用防抖,确保不频繁调用
+
+    updateButtonVisibility() {
+      this.isBtn = this.docmHeight <= this.showHeight;
+    },
+
+    // 获取文档高度的工具函数
+    getDocumentHeight() {
+      return document.documentElement.clientHeight || document.body.clientHeight;
     }
   }
 }

+ 2 - 2
src/views/menu/iot/smartOpration/components/item.vue

@@ -5,7 +5,7 @@
         <template #title>
           <span>{{data.orgName}}</span>
           <van-tag type="success" v-if="getNormalChannelCount>0" @click="showNormalChannel()" class="custom-title-tag">正常通道:{{getNormalChannelCount}}</van-tag>
-          <van-tag type="warning" v-if="getExceptionChannelCount>0" @click="showExceptionChannel()"  class="custom-title-tag">异常通道:{{getExceptionChannelCount}}</van-tag>
+          <van-tag type="danger" v-if="getExceptionChannelCount>0" @click="showExceptionChannel()"  class="custom-title-tag">异常通道:{{getExceptionChannelCount}}</van-tag>
         </template>
         <template #right-icon v-if="data.channels && data.channels.length > 0">
           <van-icon
@@ -43,7 +43,7 @@
               style="width: 80%"
               size="small"
               v-else-if="channel.state == 1"
-              type="warning"
+              type="danger"
               @click="itemClick(data.hostCode, channel.channelCode)"
             >
               {{  channel.channelName}}</van-button

+ 7 - 3
src/views/menu/problemItem/index.vue

@@ -5,7 +5,7 @@
       <van-search v-model="query.searchKey" class="van-hairline--bottom" placeholder="请输入搜索关键词" @search="refreshData" />
       <org-tree v-model="query.orgId"  @change="refreshData" showChecked @checked="checked"></org-tree>
       <div class="search-flex">
-        <select-cell
+        <search-select-cell
           style="border-right: 1px solid #f5f5f5;"
           title="问题状态"
           :isAll="true"
@@ -13,7 +13,7 @@
           v-model="query.status"
           :data-list="getDictItem('app_question_status')"
           @change="refreshData"/>
-        <date-cell title="截止日期"  v-model="query.reformDate" @change="refreshData"/>
+        <search-date-cell title="截止日期"  v-model="query.reformDate" @change="refreshData"/>
       </div>
       <div class="card-list">
         <Scroll
@@ -94,7 +94,9 @@ import OrgTree from '@/components/orgTree'
 import Scroll from '@/components/scroll/scroll'
 import Card from '@/components/card'
 import dateCell from '@/components/dateCell'
+import searchDateCell from '@/components/dateCell/search.vue'
 import selectCell from '@/components/selectCell'
+import searchSelectCell from '@/components/selectCell/search.vue'
 import {dataList} from './api'
 import {mapGetters} from "vuex";
 import {formatDate} from "@/filters/filter";
@@ -107,6 +109,8 @@ export default {
     Card,
     dateCell,
     selectCell,
+    searchDateCell,
+    searchSelectCell,
   },
   data() {
     return {
@@ -211,7 +215,7 @@ export default {
       setTimeout(() => {
         if(!this.query.orgId){
           this.query.orgId = this.orgId;
-        }        
+        }
       }, 200);
     },
     clickItem(id,type){

+ 8 - 22
src/views/menu/rehearsalTask/components/dialog.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <van-action-sheet class="bigsheetbox" @closed="closedHandler" v-model="show" safe-area-inset-bottom position="bottom" title="选择演练库">
+    <van-dialog v-model="show" title="选择演练库" width="95%" @confirm="submitHandler" show-cancel-button>
       <van-row>
         <van-col span="24">
           <div class="line"></div>
@@ -36,12 +36,7 @@
           </van-collapse>
         </van-col>
       </van-row>
-      <van-row class="bottomdiv">
-        <van-col span="24">
-          <van-button class="btns" size="large" type="info" @click="submitHandler">确定</van-button>
-        </van-col>
-      </van-row>      
-    </van-action-sheet>
+    </van-dialog>
   </div>
 </template>
 <script>
@@ -187,22 +182,10 @@ export default {
   z-index: 999;
 }
 .van-action-sheet {
-  min-height: 90%;
-}
-.btns {
-  width: 100%;
-  height: 90px;
-}
-.bottomdiv {
-  width: 100%;
-  bottom: 0%;
-  position: absolute;
-  margin-top: 20px;
-  z-index: 2000;
-  padding-bottom:calc(0 + env(safe-area-inset-bottom));
+  min-height: 70%;
 }
 .bigsheetbox {
-  height: calc(100vh - 100px);
+  height: calc(90vh - 200px);
 }
 .line {
   width: 100%;
@@ -211,7 +194,7 @@ export default {
 }
 .rowclss {
   // margin-bottom: 100px;
-  height: calc(100vh - 180px);
+  height: calc(80vh - 180px);
   // height: 1050px;
   overflow: scroll;
 }
@@ -220,4 +203,7 @@ export default {
   white-space: pre-wrap;
   // text-align: left;
 }
+::v-deep .van-dialog{
+  top: 50% !important;
+}
 </style>

+ 223 - 0
src/views/menu/rehearsalTask/components/dialog_bak.vue

@@ -0,0 +1,223 @@
+<template>
+  <div>
+    <van-action-sheet class="bigsheetbox" @closed="closedHandler" v-model="show" safe-area-inset-bottom position="bottom" title="选择演练库">
+      <van-row>
+        <van-col span="24">
+          <div class="line"></div>
+        </van-col>
+      </van-row>
+
+      <van-row>
+        <van-col span="24">
+          <van-search v-model="searchVal" placeholder="请输入搜索关键词" @input="onSearch" @cancel="onCancel" />
+        </van-col>
+      </van-row>
+
+      <van-row class="rowclss">
+        <van-col span="24">
+          <van-collapse v-model="activeNames" @change="checkedHandler" accordion>
+            <van-checkbox-group v-model="result" @change="changeCheckBox">
+              <van-collapse-item
+                :ref="item.id"
+                :name="item.id"
+                v-for="item in peopleListCpoy"
+                :key="item.id"
+                :title="item.drillProjects"
+              >
+                <!-- :title="item.defaultCause" -->
+                <template #right-icon>
+                  <van-checkbox :name="item.id" ref="checkboxes" class="checkboxList" />
+                </template>
+                <div class="lddq">
+                  {{ item.defaultCause }}
+                </div>
+              </van-collapse-item>
+            </van-checkbox-group>
+          </van-collapse>
+        </van-col>
+      </van-row>
+      <van-row class="bottomdiv">
+        <van-col span="24">
+          <van-button class="btns" size="large" type="info" @click="submitHandler">确定</van-button>
+        </van-col>
+      </van-row>      
+    </van-action-sheet>
+  </div>
+</template>
+<script>
+import { deptTreeList } from '@/api/toConsult.js'
+import { drillDictionaryList,drillDictionaryBranchList } from '@/api/drillTask.js'
+import OrgTree from '@/components/orgTree'
+import { list } from '@/api/protection'
+export default {
+  name: 'SocAppIndex',
+  components: {
+    OrgTree
+  },
+  props: {
+    userList: {
+      type: Array,
+      default: () => {
+        return []
+      }
+    },
+    dictValue: {},
+    organizationId: {
+      //机构ID
+      type: String,
+      default: JSON.parse(window.sessionStorage.getItem('SET_USER_ORGID')) + ''
+    },
+
+    inpitLabel: {
+      type: String,
+      default: '参演人员'
+    },
+    fieldNames: {
+      //树行配置映射项
+      type: Object,
+      default: () => {
+        return {
+          text: 'name',
+          value: 'id',
+          children: 'children'
+        }
+      }
+    }
+  },
+  data() {
+    return {
+      activeNames: [],
+      orgId: this.organizationId || '',
+      show: false,
+      value1: '',
+      showcascader: false,
+      cascaderValue: '',
+      loading: false,
+      options: [], //机构列表
+      result: [], //人员ID集合
+      searchVal: '', //搜索值
+      peopleList: [], //人员列表
+      peopleListCpoy: [], //人员列表2
+      orgName: '' //机构名称
+    }
+  },
+  created() {},
+  mounted() {},
+
+  methods: {
+    // 弹框关闭动画
+    closedHandler() {
+      this.searchVal = ''
+    },
+    //复选框发生变化
+    changeCheckBox(list) {
+      if (list && list.length > 1) {
+        this.result = [list[list.length - 1]]
+      }
+    },
+    init() {
+      this.show = true
+      this.getpeople()
+    },
+    onLoad() {},
+    getpeople() {
+      drillDictionaryList({ orgId: this.orgId, dictValue: this.dictValue }).then(res => {
+        let { code, data, msg } = res
+        if (code == 200) {
+          console.log(res)
+          this.peopleList = data
+          this.peopleListCpoy = JSON.parse(JSON.stringify(this.peopleList))
+          this.peopleListCpoy.forEach(item => {
+            this.$set(item, 'checked', false)
+          })
+        }
+      })
+    },
+    initBranch() {
+      this.show = true
+      this.getBranchPeople()
+    },
+    getBranchPeople() {
+      drillDictionaryBranchList({ orgId: this.orgId, dictValue: this.dictValue }).then(res => {
+        let { code, data, msg } = res
+        if (code == 200) {
+          console.log(res)
+          this.peopleList = data
+          this.peopleListCpoy = JSON.parse(JSON.stringify(this.peopleList))
+          this.peopleListCpoy.forEach(item => {
+            this.$set(item, 'checked', false)
+          })
+        }
+      })
+    },
+
+    onSearch(val) {
+      this.peopleListCpoy = this.peopleList.filter(item => {
+        if (item.defaultCause.indexOf(val) != -1) {
+          return item
+        }
+      })
+    },
+    onCancel() {
+      this.searchVal = ''
+      this.peopleListCpoy = this.peopleList
+    },
+    submitHandler() {
+      let list = []
+      this.peopleListCpoy.filter(item => {
+        this.result.forEach(r => {
+          if (r == item.id) {
+            list.push(item)
+          }
+        })
+      })
+      this.show = false
+
+      // 抛出已选择人员信息
+      this.$emit('checkList', list)
+    },
+    checkedHandler(id) {
+      this.result.push(id)
+    }
+  }
+}
+</script>
+<style lang="scss" scoped>
+.checkboxList {
+  z-index: 999;
+}
+.van-action-sheet {
+  min-height: 90%;
+}
+.btns {
+  width: 100%;
+  height: 90px;
+}
+.bottomdiv {
+  width: 100%;
+  bottom: 0%;
+  position: absolute;
+  margin-top: 20px;
+  z-index: 2000;
+  padding-bottom:calc(0 + env(safe-area-inset-bottom));
+}
+.bigsheetbox {
+  height: calc(100vh - 100px);
+}
+.line {
+  width: 100%;
+  height: 3px;
+  background-color: #1989fa;
+}
+.rowclss {
+  // margin-bottom: 100px;
+  height: calc(100vh - 180px);
+  // height: 1050px;
+  overflow: scroll;
+}
+.lddq {
+  text-align: justify;
+  white-space: pre-wrap;
+  // text-align: left;
+}
+</style>

+ 27 - 4
src/views/menu/safeCheckStatistics/index.vue

@@ -85,8 +85,8 @@ export default {
       showStartMonth: false, //月份显示隐藏
       showEndMonth: false, //月份显示隐藏
       fieldValue: '', //状态名称
-      startMonth: newDateMonth(), //年份
-      endMonth: newDateMonth(), //年份
+      startMonth: null, //年份
+      endMonth: null, //年份
       showStartSelectTimeText: this.getDayStr(new Date(), 'YYYY-MM'),
       showEndSelectTimeText: this.getDayStr(new Date(), 'YYYY-MM'),
       yearSelect: null,
@@ -115,14 +115,37 @@ export default {
     }
   },
   created() {
-    this.startMonth = new Date(newDateMonth())
-    this.endMonth = new Date(newDateMonth())
+ /*   this.startMonth = new Date(newDateMonth())
+    this.endMonth = new Date(newDateMonth())*/
+    this.initQuery();
   },
   mounted() {
     this.initData()
   },
   computed: {},
   methods: {
+    initQuery(){
+      //页面创建时,设置时间
+      //获取当前月份
+      const now = new Date();
+      const month = now.getMonth() + 1;
+      if(month >=1 && month <= 6){
+        let start = now.getFullYear() + "-01-1"
+        let end = now.getFullYear() + "-06-1"
+        this.startMonth = new Date(start);
+        this.endMonth = new Date(end);
+        this.showStartSelectTimeText = this.getDayStr(this.startMonth, 'YYYY-MM');
+        this.showEndSelectTimeText = this.getDayStr(this.endMonth, 'YYYY-MM');
+      }else{
+        let start = now.getFullYear() + "-07-1"
+        let end = now.getFullYear() + "-12-1"
+        this.startMonth = new Date(start);
+        this.endMonth = new Date(end);
+        this.showStartSelectTimeText = this.getDayStr(this.startMonth, 'YYYY-MM');
+        this.showEndSelectTimeText = this.getDayStr(this.endMonth, 'YYYY-MM');
+      }
+
+    },
     formatter(type, val) {
       if (type === 'month') {
         return `${val}月`;

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

@@ -73,7 +73,7 @@
                 <div :class="{'active':v.active==1}" @click.stop="changeList(v,1)">
                   <p>{{v.completed.length}}</p>
                   <p>已检查</p>
-                </div>  
+                </div>
                 </div>
               </div>
             </template>
@@ -106,6 +106,7 @@ import NavBar from '@/components/NavBar'
 import OrgTree from '@/components/orgTree'
 import Card from '@/components/card'
 import DateCell from '@/components/dateCell'
+import SearchDateCell from '@/components/dateCell/search.vue'
 import SelectCell from '@/components/selectCell'
 import SearchSelectCell from '@/components/SearchSelectCell'
 import Scroll from '@/components/scroll/scroll'
@@ -121,6 +122,7 @@ export default {
     DateCell,
     SelectCell,
     SearchSelectCell,
+    SearchDateCell,
     Scroll
   },
   data() {

+ 11 - 13
src/views/menu/training/components/selectData.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <van-action-sheet class="bigsheetbox" v-model="show" position="bottom" title="选择资料">
+    <van-dialog v-model="show" title="选择资料" width="95%" @confirm="submitHandler" show-cancel-button>
       <van-row>
         <van-col span="24">
           <!-- <van-search v-model="searchVal" placeholder="请输入搜索关键词" /> -->
@@ -35,12 +35,7 @@
           </van-collapse>
         </van-col>
       </van-row>
-      <van-row class="bottomdiv">
-        <van-col span="24">
-          <van-button class="btns" size="large" type="info" @click="submitHandler">确定</van-button>
-        </van-col>
-      </van-row>
-    </van-action-sheet>
+    </van-dialog>
   </div>
 </template>
 <script>
@@ -167,12 +162,12 @@ export default {
     //   }
     // },
     checkedHandler(id) {
-     
+
       this.result=id
-      
+
     },
     tagHandler(i) {
-     
+
       this.openFilePreview(i)
       // const filePath = `${process.env.NODE_ENV === 'development' ? '/dev' : window.origin}${i.url}`
       // const tempLink = document.createElement('a')
@@ -192,7 +187,7 @@ export default {
 </script>
 <style lang="scss" scoped>
 .van-action-sheet {
-  min-height: 90%;
+  min-height: 70%;
 }
 .btns {
   width: 100%;
@@ -208,12 +203,12 @@ export default {
 }
 .rowclss{
   // height: 1050px;
-  height: calc(100vh - 180px);
+  height: calc(80vh - 180px);
   overflow: scroll;
 }
 .bigsheetbox {
 
-  height: calc(100vh - 100px);
+  height: calc(80vh - 200px);
 }
 .van-field__control {
   padding-right: 20px;
@@ -229,4 +224,7 @@ export default {
     margin-top: 10px;
   }
 }
+::v-deep .van-dialog{
+  top: 50% !important;
+}
 </style>

+ 232 - 0
src/views/menu/training/components/selectData_bak.vue

@@ -0,0 +1,232 @@
+<template>
+  <div>
+    <van-action-sheet class="bigsheetbox" v-model="show" position="bottom" title="选择资料">
+      <van-row>
+        <van-col span="24">
+          <!-- <van-search v-model="searchVal" placeholder="请输入搜索关键词" /> -->
+          <form action="/">
+
+            <van-search v-model="searchVal" placeholder="请输入搜索关键词" clearable @input="onSearch" />
+          </form>
+        </van-col>
+      </van-row>
+
+      <van-row class="rowclss">
+        <van-col span="24">
+          <van-collapse v-model="activeNames" @change="checkedHandler">
+            <van-checkbox-group v-model="result" >
+              <van-collapse-item
+                v-for="item in peopleListCpoy"
+                :name="item.id"
+                :key="item.id"
+                :title="`${item.title}-(${item.orgName})`"
+              >
+                <!-- :title="item.defaultCause" -->
+                <template #right-icon>
+                  <van-checkbox :name="item.id" > </van-checkbox>
+                </template>
+                <van-row>
+                  <van-col class="colCls" span="24" v-for="i in item.fileList" :key="i.name">
+                    <van-tag type="primary" class="tagCls" plain @click="tagHandler(i)">{{ i.name }}</van-tag>
+                  </van-col>
+                </van-row>
+              </van-collapse-item>
+            </van-checkbox-group>
+          </van-collapse>
+        </van-col>
+      </van-row>
+      <van-row class="bottomdiv">
+        <van-col span="24">
+          <van-button class="btns" size="large" type="info" @click="submitHandler">确定</van-button>
+        </van-col>
+      </van-row>
+    </van-action-sheet>
+  </div>
+</template>
+<script>
+import { deptTreeList } from '@/api/toConsult.js'
+import { materialsFileList } from '@/api/training.js'
+import OrgTree from '@/components/orgTree'
+import { Toast } from 'vant'
+export default {
+  name: 'SocAppIndex',
+  components: {
+    OrgTree
+  },
+
+  props: {
+    organizationId: {
+      //机构ID
+    },
+    //培训资料数量
+    listLength: {
+      type: Number
+    }
+  },
+  data() {
+    return {
+      activeNames: [],
+      result: [],
+      orgId: this.organizationId || '',
+      show: false,
+      value1: '',
+      showcascader: false,
+      cascaderValue: '',
+      loading: false,
+      options: [], //机构列表
+      peoplesId: [], //资料ID集合
+      searchVal: '', //搜索值
+      peopleList: [], //资料列表
+      peopleListCpoy: [], //资料列表2
+      orgName: '', //机构名称
+      peoples: '' //资料列表
+    }
+  },
+  watch: {
+    organizationId(val) {
+      this.orgId = val + ''
+      this.getSelectData()
+    },
+    //监听弹框是否打开
+    show(val) {
+      if (val) {
+        this.getSelectData()
+      }
+    },
+    //监听资料数组变化
+    userList(val) {
+      this.peoplesId = []
+      this.$set(this.$data, 'peoples', val.map(item => item.userName).join(','))
+
+      val.map(item => {
+        this.peoplesId.push(item.userId)
+      })
+    }
+  },
+
+  created() {},
+  mounted() {},
+
+  methods: {
+    onLoad() {},
+    //获取资料
+    getSelectData() {
+      materialsFileList({ orgId: this.orgId, pageNum: 1, pageSize: 100000 }).then(res => {
+        let { code, rows, msg } = res
+        if (code == 200) {
+          rows.forEach(item => {
+            if (item.fileList && item.fileList.length > 0) {
+              item.fileList = item.fileList.map(i => {
+                i = JSON.parse(i)
+                return i
+              })
+            }
+          })
+
+          this.peopleList = rows
+          this.peopleListCpoy = JSON.parse(JSON.stringify(rows))
+        }
+      })
+    },
+
+    onSearch(val) {
+      this.peopleListCpoy = this.peopleList.filter(item => {
+        if (item.title.indexOf(val) != -1 || item.orgName.indexOf(val) != -1) {
+          return item
+        }
+      })
+    },
+
+    onCancel() {
+      this.searchVal = ''
+      this.peopleListCpoy = this.peopleList
+    },
+    submitHandler() {
+      let list = []
+      this.peopleListCpoy.filter(item => {
+        this.result.forEach(r => {
+          if (r == item.id) {
+            list.push(...item.fileList)
+          }
+        })
+      })
+
+      // this.peoples = list.map(item => item.name).join(',')
+      if (list.length + this.listLength > 5) {
+        return Toast('资料附件数量不能超过5个,请修改!')
+      }
+      this.$set(this.$data, 'peoples', list.map(item => item.name).join(','))
+      // 抛出已选择资料信息
+      this.$emit('dataList', list)
+      this.show = false
+    },
+    //复选框单选
+    // changeCheckBox(list) {
+    //   if (list && list.length > 1) {
+    //     this.result = [list[list.length - 1]]
+    //   }
+    // },
+    checkedHandler(id) {
+     
+      this.result=id
+      
+    },
+    tagHandler(i) {
+     
+      this.openFilePreview(i)
+      // const filePath = `${process.env.NODE_ENV === 'development' ? '/dev' : window.origin}${i.url}`
+      // const tempLink = document.createElement('a')
+      // tempLink.style.display = 'none'
+      // tempLink.href = filePath
+      // tempLink.setAttribute('download', i.name)
+      // tempLink.setAttribute('target', '_blank')
+      // document.body.appendChild(tempLink)
+      // tempLink.click()
+      // document.body.removeChild(tempLink)
+    },
+    clickHandler() {
+      console.log('哈哈哈哈')
+    }
+  }
+}
+</script>
+<style lang="scss" scoped>
+.van-action-sheet {
+  min-height: 90%;
+}
+.btns {
+  width: 100%;
+  height: 90px;
+}
+.bottomdiv {
+  width: 100%;
+  bottom: 0%;
+  position: absolute;
+  margin-top: 20px;
+  z-index: 2000;
+  padding-bottom:calc(0 + env(safe-area-inset-bottom));
+}
+.rowclss{
+  // height: 1050px;
+  height: calc(100vh - 180px);
+  overflow: scroll;
+}
+.bigsheetbox {
+
+  height: calc(100vh - 100px);
+}
+.van-field__control {
+  padding-right: 20px;
+}
+.line {
+  width: 100%;
+  height: 3px;
+  background-color: #1989fa;
+}
+.colCls {
+  display: flex;
+  .tagCls {
+    margin-top: 10px;
+  }
+}
+</style>