wenmenghao321 2 năm trước cách đây
mục cha
commit
3c07ab87b7
2 tập tin đã thay đổi với 24 bổ sung19 xóa
  1. 10 6
      src/web/staticres/js/superSearch.js
  2. 14 13
      src/web/templates/common/personDialog.html

+ 10 - 6
src/web/staticres/js/superSearch.js

@@ -1604,24 +1604,28 @@ function distributeInit(){
   $('#right-distribute').off('click').bind('click',function(e){
     e.stopPropagation()
     let len = $('.custom-checkbox:not(".check-all"):checked').length;
-    let checkedData = [] 
+    let checkedArea = [] 
+    let checked_id = []
     $('.custom-checkbox:not(".check-area"):checked').each(function(){
       if ($(this).attr('data-area')) {
-        checkedData.push($(this).attr('data-area'))
+        checkedArea.push($(this).attr('data-area'))
+      }
+      if ($(this).attr('dataid')) {
+        checked_id.push($(this).attr('dataid'))
       }
     })
     if(len) {
-      if(checkedData.length !== 0){
+      if(checkedArea.length !== 0){
         // 拉起选择人员弹窗 有地区
-  
+        person_Dialog.selectAreas = checkedArea
       }else{
         // 无地区
-        
+        person_Dialog.selectArea = []  
       }
       person_Dialog.titleMsg = '选择分发人员'
       person_Dialog.searchVal = ''
       person_Dialog.centerDialogVisible = true
-      person_Dialog.selectDataIds = selectDataIds
+      person_Dialog.selectDataIds = checked_id
       person_Dialog.getData('yes')
     }else{
       toastFn('尚未选择公告,请选择', 1000)

+ 14 - 13
src/web/templates/common/personDialog.html

@@ -103,7 +103,8 @@
       empower_count: 0, // 购买人数
       selectDataIds: [],
       filterType: false,
-      _scrollTop:''
+      _scrollTop:'',
+      selectAreas:[]
     }
   },
   created () {
@@ -197,16 +198,16 @@
     async getData (flag = 'no', num) {
       this.filterType = !!num
       this.loading = true
-      const selectAreas = []
-      this.list.forEach((v, i) => {
-        this.selectDataIds.forEach((s, index) => {
-          if (v._id === s) {
-            if (v.area) {
-              selectAreas.push(v.area)
-            }
-          }
-        })
-      })
+      const selectAreas = this.selectAreas
+      // this.list.forEach((v, i) => {
+      //   this.selectDataIds.forEach((s, index) => {
+      //     if (v._id === s) {
+      //       if (v.area) {
+      //         selectAreas.push(v.area)
+      //       }
+      //     }
+      //   })
+      // })
       const params = {
         region: num ? '' : selectAreas.toString(),
         queryType: num || ''
@@ -262,7 +263,7 @@
         // 若大于3s,则把现在的时间赋值个lastTime
         this.lastTime = now
         const delId = []
-        this.selectedList.forEach((v, i) => {
+        this.selectedList.forEach((v, i) => { // 选中人员ID
           delId.push(v.id)
         })
         this.centerDialogVisible = false
@@ -271,7 +272,7 @@
             console.log('刷新?')
            
           } else {
-            getMsgDistributor({ messageId: getCaIndexIds.toString(), staffs: data }).then(res => {
+            getMsgDistributor({ messageId: this.selectDataIds.toString(), staffs: data }).then(res => {
              if (res.error_code === 0) {
               if (res.data === 1) {
                this.$message({ message: '分发成功', type: 'success' })